title: Why can't Spark find the classes in this Jar?
body: <p>I am new to spark. I am trying to compile and run a spark application that requires classes from an (external) jar file on my local machine. If I open the jar (on ~/Desktop) I can see the missing class in the local jar but when I run spark I get </p>
  
  <pre><code>NoClassDefFoundError: edu/stanford/nlp/ie/AbstractSequenceClassifier
  </code></pre>
  
  <p>I add the jar to the spark context like this</p>
  
  <pre><code>String[] jars = {"/home/pathto/Desktop/stanford-corenlp-3.5.0.jar"};
  SparkConf conf = new SparkConf().setAppName("Simple Application").setJars(jars);
  </code></pre>
  
  <p>Then I try to run a submit script like this</p>
  
  <pre><code>/home/pathto/Downloads/spark-1.2.0-bin-hadoop2.4/bin/spark-submit \
    --class "SimpleApp" \
    --master local[4] \
    target/simple-project-1.0.jar \
    --jars local[4] /home/abe/Desktop/stanford-corenlp-3.5.0.jar
  </code></pre>
  
  <p>and hit the NoClassDefFoundError. </p>
  
  <p>I get that this means that the worker threads can't find the class from the jar. But I am not sure what I am doing wrong. I have tried different syntaxes for the last line (below) but none works.</p>
  
  <pre><code>  --addJars local[4] /home/abe/Desktop/stanford-corenlp-3.5.0.jar
    --addJars local:/home/abe/Desktop/stanford-corenlp-3.5.0.jar
    --addJars local:/home/abe/Desktop/stanford-corenlp-3.5.0.jar
  </code></pre>
  
  <p>How can I fix this error?</p>