Search code examples
javajarjvmexecutable-jarjvm-crash

Failed to load Main-class Manifest Attribute


I am getting following error while executing compiled jar file. I have re installed my java but my problem is not solved yet.

Failed to load Main-class Manifest Attribute from
D:\Tools\Lodable_Creation\dist\Lodable_Creation.jar

Currently by MANIFEST.MF file looks like.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0-b105 (Sun Microsystems Inc.)
Main-Class: main
X-COMMENT: Main-Class will be added automatically by build

I am using Netbeans 6.9.1 IDE.


Solution

  • Use a package for your class. Make sure your class looks something like this (notice the package and the public class):

    package com.foo;
    
    public class Main {
    
        public static void main(String[] args) {
        }
    }
    

    After which you can specify Main-Class as so:

    Main-Class: com.foo.Main