title: I have built a jar file using maven, but cannot execute it using the "java" command in linux
body: <p>thanks in advance for the help!</p>
  
  <p>To clarify my problem:</p>
  
  <p>1) I have an ec2-instance and wrote a java program. I've called it HelloWorld.java</p>
  
  <p>2) I've built a jar file for HelloWorld.java called hello.jar using maven. I used a random pom file with some random dependencies since I figured HelloWorld doesn't need a pom file other than to give the jar file a name.</p>
  
  <p>3) I've been using a spark-submit script to submit apps, but the app I am now trying to run does not have spark involved in it and I want to also deploy it in an environment where spark is not involved. <strong>So I want to submit the app using the "java" command.</strong> I am not sure if I should be submitting the jar file, the .java file, etc. I've seen that I have to give it a .class argument. I'm not sure what to put?</p>
  
  <p>4) My next step is having a java program that has a set of 4 jars dependencies. I would love to know how I can add the 4 jar files as an argument for the "java" command.</p>
  
  <p><strong>EDIT</strong> @Ascalonian</p>
  
  <p>I tried John Skeets answer and got this exception when I tried the jar command: </p>
  
  <pre><code>java.io.IOException: invalid header field
          at java.util.jar.Attributes.read(Attributes.java:393)
          at java.util.jar.Manifest.read(Manifest.java:182)
          at java.util.jar.Manifest.&lt;init&gt;(Manifest.java:52)
          at sun.tools.jar.Main.run(Main.java:151)
          at sun.tools.jar.Main.main(Main.java:1149)
  </code></pre>
  
  <p><strong>EDIT 2</strong> John Skeet's answer ended up working when I recreated the solution. No idea what changed, but it worked. Thanks for the help!</p>
  
  <p>Thanks!</p>
  
  <p>Thank you!</p>