title: How to set heap size in spark within the Eclipse environment?
body: <p>I am trying to run the simple following code using spark within Eclipse:</p>
  
  <pre class="lang-java prettyprint-override"><code>import org.apache.spark.sql.SQLContext
  import org.apache.spark.SparkConf
  import org.apache.spark.SparkContext
  object jsonreader {  
    def main(args: Array[String]): Unit = {
      println("Hello, world!")
      val conf = new SparkConf()
        .setAppName("TestJsonReader")
        .setMaster("local")
        .set("spark.driver.memory", "3g") 
      val sc = new SparkContext(conf)
  
      val sqlContext = new SQLContext(sc)
      val df = sqlContext.read.format("json").load("text.json")
  
      df.printSchema()
      df.show   
    }
  }
  </code></pre>
  
  <p>However, I get the following errors:</p>
  
  <pre><code>16/08/18 18:05:28 ERROR SparkContext: Error initializing SparkContext.
  java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200. Please increase heap size using the --driver-memory option or spark.driver.memory in Spark configuration.
  </code></pre>
  
  <p>I followed different tutorials like this one: <a href="https://stackoverflow.com/questions/26562033/how-to-set-apache-spark-executor-memory">How to set Apache Spark Executor memory</a>. Most of time either I use <code>--driver-memory</code> option (not possible with Eclipse) or by modifiying the spark configuration but there is no corresponding file.</p>
  
  <p>Does anyone have any idea about how to solve this issue within Eclipse environment?</p>