title: how to overcome spark "cannot parse master URL" error?
body: <p>I have the following simple code in IntelliJ IDEA on my Mac:</p>
  
  <pre><code>import org.apache.spark.SparkContext
  import org.apache.spark.SparkContext._
  import org.apache.spark.SparkConf
  
  
  object SparkGrep {
    def main(args: Array[String]) {
      if (args.length &lt; 3) {
        System.err.println("Usage: SparkGrep &lt;host&gt; &lt;input_file&gt; &lt;match_term&gt;")
        System.exit(1)
      }
      val conf = new SparkConf().setAppName("SparkGrep").setMaster(args(0))
      val sc = new SparkContext(conf)
      val inputFile = sc.textFile(args(1), 2).cache()
      val matchTerm : String = args(2)
      val numMatches = inputFile.filter(line =&gt; line.contains(matchTerm)).count()
      println("%s lines in %s contain %s".format(numMatches, args(1), matchTerm))
      System.exit(0)
    }
  }
  </code></pre>
  
  <p>In my run configuration, I have added the following program arguments:</p>
  
  <pre><code>local[*] src/SparkGrep.scala val
  </code></pre>
  
  <p>When I run this code, I get the following error:</p>
  
  <pre><code>Exception in thread "main" org.apache.spark.SparkException: Could not parse Master URL: 'local[*]'
      at org.apache.spark.SparkContext$.org$apache$spark$SparkContext$$createTaskScheduler(SparkContext.scala:1304)
      at org.apache.spark.SparkContext.&lt;init&gt;(SparkContext.scala:199)
      at spark.SparkTest.SparkGrep$.main(SparkGrep.scala:26)
      at spark.SparkTest.SparkGrep.main(SparkGrep.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  </code></pre>
  
  <p>What can I do to overcome this error?</p>