title: What is the difference between submitting spark job to spark-submit and to hadoop directly?
body: <p>I have noticed that in my project there are 2 ways of running spark jobs.</p>
  <ol>
  <li><p>First way is submitting a job to spark-submit file</p>
  <p>./bin/spark-submit <br />
  --class org.apache.spark.examples.SparkPi <br />
  --master local[8] <br />
  /path/to/examples.jar <br />
  100</p>
  </li>
  <li><p>Second way is to package java file into jar and run it via hadoop, while having Spark code inside MainClassName:</p>
  <p>hadoop jar JarFile.jar MainClassName</p>
  </li>
  </ol>
  <p>`
  What is the difference between these 2 ways?
  Which prerequisites I need to have in order to use either?</p>