Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Run JAR Applications

If there is only 1 class with a main method or if there is a Main-Class defined for the JAR, you can use the following command to run the application.

java -jar app.jar

If you there are multiple classes with main methods in the JAR, you can execute any of them using the commands below.

java -cp app.jar com.mycomp.myproj.AnotherClassWithMainMethod

Comments