Option1: create a manifest file with an entry as shown below and include in the jar:
Main-Class: MainProgram
Option 2: just specify the class name Main at program startup, for example. if you are jar name myprogram.jar and the main class is MainProgram , then run the program as shown below:
java -cp myprogram.jar MainProgram
If your MainProgram takes some arguments, they pass them also on the command line, for example.
java -cp myprogram.jar MainProgram argument1 argument2
source share