java - Run jar file in command prompt

ID : 10427

viewed : 24

Tags : javajarjava

Top 5 Answer for java - Run jar file in command prompt

vote vote

100

Try this

java -jar <jar-file-name>.jar 
vote vote

85

If you dont have an entry point defined in your manifest invoking java -jar foo.jar will not work.

Use this command if you dont have a manifest or to run a different main class than the one specified in the manifest:

java -cp foo.jar full.package.name.ClassName 

See also instructions on how to create a manifest with an entry point: https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

vote vote

76

java [any other JVM options you need to give it] -jar foo.jar

vote vote

70

You can run a JAR file from the command line like this:

java -jar myJARFile.jar 
vote vote

60

I would comment if i could , but i have no permissions yet, so i will post a hint as an answer, for unexpected behavior on some android devices:

Position: Fixed only works in Android 2.1 thru 2.3 by using the following meta tag:

<meta name="viewport" content="width=device-width, user-scalable=no">. 

see http://caniuse.com/#search=position

Top 3 video Explaining java - Run jar file in command prompt

Related QUESTION?