Javatpoint Logo
Javatpoint Logo

No Main Manifest Attribute

In a Java project, every executable jar file contains a main method. Usually, it is placed at starting point of the application. To execute a main method by a self-executing jar file, we must have a proper manifest file and wrap it with our project at the proper location. These files have a main manifest attribute that is used to define the path to class having the main method.

Sometimes, we have a self-executable jar, and when we try to execute the project, it will throw the following error message:

The above error message is thrown because of a missing entry of Main-Class in MANIFEST.MF file.

You may encounter this problem in any configuration-based Java project. Let's discuss its solutions:


Let's understand its solutions in different projects:


In Maven Project, this problem may encounter because of the missing entry of Main-Class in MANIFEST.MF file. To overcome this issue, we may define it in our pom.xml file by manually putting a maven-jar-plugin in pom.xml.

In the above code, com.javatpoint.AppMain is our fully qualified name of the Main-Class. You have to replace the fully qualified name according to your classpath. To copy the fully qualified name, right-click on the package that contains the main class and select Copy Fully Qualified Name.


If you are getting this error in your Gradle project, you can solve this by putting the following entries in your build.gradle file:

Spring Boot Application

Sometimes this error may be encountered in your Spring Boot project. It is easy to resolve this error in the Spring Boot project. To fix this error in the SB project, put the maven-plugin dependency under the <plugins> tag in the pom.xml file.

Root Cause of the No Main Manifest Attribute Error

The "no main manifest error" is usually caused if you messed in MANIFEST.MF file located under META-INF folder. By default, it has the following entry:


Manifest-Version is the version of the Manifest file.

Built-By is your PC name.

Build-Jdk is the JDK version installed in your machine.

Created-By is the plugin name used in IDE.

When we run the project, it will look for the Main-Class in MANIFEST.MF file. It will throw the error message "Unable to execute jar-file" if it does not find the entry. When we run the above solutions, the class entry will automatically be updated in the project's Manifest file as follows:

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA