About
Language - (Main|Application Entry point) in Java is called a Main class.
The (Main|Start) class is a class that:
- have a main method
- will start the main thread (process)
You may have several main class in a jar
Articles Related
How to execute a main class ?
Java
You can start the java application by:
- calling the java client
- giving your main class and the arguments of the main method
java -classPath myJar.jar com.package.myMainClass arg1 arg2
Runnable Jar and Manifest file
If in the jar, you have a manifest file that contains the Main-Class attribute, the jar becomes a runnable jar
Manifest-version: 1.0
Main-Class: HelloWorld
and can be executed like that:
java -jar myStartableJar.jar
Maven
Maven will take care of the classpath
mvn package exec:java -Dexec.mainClass=package.Class