How to start a specific main class from a jar

I have a jar file with two Java classes that have basic methods. Is there a way that I can indicate when running the jar file which class to call? I know that the manifest file can be modified to indicate the main class, but since only one class is mentioned, this does not help. I checked the links below, but these problems solve the problem:

stack overflow

manifest file execute main class from jar

It gives a NoClassDefFoundError.

+5
source share
3 answers
java -cp target/your_file.jar your.package.name.YourClass
+2
source

, . main() .

+1

Write a main class in which the main method calls the actual method depending on the passed command line argument. Add this main class to the manifest.

0
source

All Articles