Multiple runnable classes inside JAR, how to run them?

The executable Jar file format only allows you to specify one main class. In order for you to be able to execute different applications, you’ll need to either create a “manager” as you suggest, or to use the classpath instead:

java -cp myjar.jar MyClass

However, this approach will ignore the classpath you have configured in the Jar’s manifest file.

Leave a Comment