title: spark-submit through java code
body: <p>I am trying spark-submit through Java code. I am referring the following example.</p>
  
  <p><a href="https://github.com/mahmoudparsian/data-algorithms-book/blob/master/misc/how-to-submit-spark-job-to-yarn-from-java-code.md" rel="nofollow">https://github.com/mahmoudparsian/data-algorithms-book/blob/master/misc/how-to-submit-spark-job-to-yarn-from-java-code.md</a></p>
  
  <p>But I am getting </p>
  
  <pre><code>The constructor ClientArguments(String[], SparkConf) is undefined
  </code></pre>
  
  <p>This is my code.</p>
  
  
  
  <pre><code>import org.apache.spark.deploy.yarn.Client;
  import org.apache.spark.deploy.yarn.ClientArguments;
  import org.apache.hadoop.conf.Configuration;
  import org.apache.spark.SparkConf;
  
  public class SparkSubmitJava {
      public static void main(String[] arguments) throws Exception {
          String[] args = new String[] {"--name", "myname", "--jar", "/home/cloudera/Desktop/ScalaTest.jar", "--class", "ScalaTest.ScalaTest.ScalaTest", "--arg","3", "--arg", "yarn-cluster"};
  
          Configuration config = new Configuration();
          System.setProperty("SPARK_YARN_MODE", "true");
          SparkConf sparkConf = new SparkConf();
          ClientArguments cArgs = new ClientArguments(args, sparkConf);  // getting constructor error
          Client client = new Client(cArgs, config, sparkConf); // getting constructor error
          client.run();
      }
  }
  </code></pre>
  
  <p>my pom.xml dependency section :</p>
  
   
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
      &lt;artifactId&gt;spark-core_2.10&lt;/artifactId&gt;
      &lt;version&gt;1.3.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
      &lt;artifactId&gt;spark-yarn_2.9.3&lt;/artifactId&gt;
      &lt;version&gt;0.8.1-incubating&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Ant help will be appreciated.</p>