Failed to load Main-class Manifest Attribute

Code Hungry picture Code Hungry · Feb 27, 2012 · Viewed 13k times · Source

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.

Answer

adarshr picture adarshr · Feb 27, 2012

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