title: Spark with Java - Error: Cannot load main class from JAR
body: <p>I am trying a simple movie recommendation machine learning program in spark. 
  Spark version:2.1.1
  Java version:java 8 
  Scala version: Scala code runner version 2.11.7 
  Env: windows 7</p>
  
  <p>Running these commands to start master and worker slaves </p>
  
  <pre><code>//start master
  spark-class org.apache.spark.deploy.master.Master
  
  //start worker
  spark-class org.apache.spark.deploy.worker.Worker spark://valid ip:7077
  </code></pre>
  
  <p>I am trying a very simple movie recommendation code from here: <a href="http://blogs.quovantis.com/recommendation-engine-using-apache-spark/" rel="nofollow noreferrer">http://blogs.quovantis.com/recommendation-engine-using-apache-spark/</a></p>
  
  <p>I have updated code to :</p>
  
  <pre><code>SparkConf conf = new SparkConf().setAppName("Collaborative Filtering Example").setMaster("spark://valid ip:7077");
  conf.setJars(new String[] {"C:\\Spark2.1.1\\spark-2.1.1-bin-hadoop2.7\\jars\\spark-mllib_2.11-2.1.1.jar"});
  </code></pre>
  
  <p>I cannot run this thru intelliJ
  Running mvn clean install and copying the jar to folder does not work.
  The command I used to run on : </p>
  
  <pre><code>bin\spark-submit --verbose –-jars jars\spark-mllib_2.11-2.1.1.jar –-class “com.abc.enterprise.RecommendationEngine” –-master spark://valid ip:7077 C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\spark-mllib-example\spark-poc-1.0-SNAPSHOT.jar C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\spark-mllib-example\ratings.csv C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\spark-mllib-example\movies.csv 10
  </code></pre>
  
  <p>The error I see is:</p>
  
  <pre><code>C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7&gt;bin\spark-submit --verbose --class "com.sandc.enterprise.RecommendationEngine" --master spark://10.64.98.101:7077 C:\Spark2.1.1\spark-2.1.1-
  bin-hadoop2.7\spark-mllib-example\spark-poc-1.0-SNAPSHOT.jar C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\spark-mllib-example\ratings.csv C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\spark-m
  llib-example\movies.csv 10
  Using properties file: C:\Spark2.1.1\spark-2.1.1-bin-hadoop2.7\bin\..\conf\spark-defaults.conf
  Adding default property: spark.serializer=org.apache.spark.serializer.KryoSerializer
  Adding default property: spark.executor.extraJavaOptions=-XX:+PrintGCDetails -Dkey=value -Dnumbers="one two three"
  Adding default property: spark.eventLog.enabled=true
  Adding default property: spark.driver.memory=5g
  Adding default property: spark.master=spark://valid ip:7077
  Error: Cannot load main class from JAR file:/C:/Spark2.1.1/spark-2.1.1-bin-hadoop2.7/û-class
  Run with --help for usage help or --verbose for debug output
  </code></pre>
  
  <p>If I give the --jar command, it gives the error:</p>
  
  <pre><code>Error: Cannot load main class from JAR file:/C:/Spark2.1.1/spark-2.1.1-bin-hadoop2.7/û-jars
  </code></pre>
  
  <p>Any ideas how I can submit this job to spark??  </p>