开发者

Run jar file in command prompt [duplicate]

开发者 https://www.devze.com 2023-02-28 17:27 出处:网络
This question already has answers here: How to run a JAR file (12 answers) Closed 3 years ag开发者_如何学JAVAo.
This question already has answers here: How to run a JAR file (12 answers) Closed 3 years ag开发者_如何学JAVAo.

How do we run a jar file in command prompt?


Try this

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


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


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


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

java -jar myJARFile.jar
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号