Showing posts with label main-class. Show all posts
Showing posts with label main-class. Show all posts

Tuesday, March 13, 2012

Maven Jar Plugin: Setting Main-Class and Class-Path in Manifest

To start a Java application you have to tell JVM where is the program's entry point (Main Class) and where to search for classes (Class Path). Main class must have a public static method called main, which takes command arguments and does the initialization. If your Java application is packaged into JAR you can define Main-Class and Class-Path in manifest file, so that JVM would be able to find your program's entry point and load necessary classes. To do so you can use maven-jar-plugin that generates manifest with Main-Class and Class-Path parameters.