Table of Contents

About

Language - (Main|Application Entry point) in Java is called a Main class.

The (Main|Start) class is a class that:

You may have several main class in a jar

How to execute a main class ?

Java

You can start the java application by:

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

Eclipse

Eclipse Main Class