Sometimes you face the following error while runing an executable jar :

No main manifest attribute, in “<APP_NAME>.jar”


  • Main-class property is missing on your jars META-INF/MANIFEST.MF. Correct it by adding the following lines to your pom.xml

Consider that the the fully qualified name of your Main class is com.roufid.tutorials.AppTest

  • Launch a clean install on your application
  • Run your executable jar using the following command :

Take time to understand !

Since your are running an executable jar file, Java will look for the manifest MANIFEST.MF located under META-INF/ which contains information about the files packaged.

Java must know the main class to run. This information was missing in the MANIFEST.MF. Below the content of this file before adding the maven-jar-plugin :

There is no mention of a Main-Class !

We used maven-jar-plugin to handle jar content and manifest configuration, specially adding a Main-Class property to MANIFEST.MF file to specify the project main class. Below the aim of the property :

  • <mainClass>com.roufid.tutorials.AppTest</mainClass>
    Is to make our Jar executable. You must set here the fully qualified name of your Main class.

The manifest classpath produced using the above configuration would look like this: