Run Jar File in Command Prompt [Duplicate]

Run Jar File in Command Prompt [Duplicate]

How do we run a jar file in command prompt?

0

4 Answers

Try this

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

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:

5

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

1

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

java -jar myJARFile.jar
1
Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.