tags:

views:

67

answers:

2

Hi, I have created a project in java project using NetBeans IDE. I have few forms in it. The netBeans created a Jar file by its own. when i try to run that Jar file its give an error "Failed to load Main-Class manifest attribute from". I Have set my Starting form in application and when i run from netbeans its running correctly but when i try to run my Jar file its give me this error. Please any one can help me how to solve this netbeans. Thanks

+1  A: 

I don't use NetBeans myself, but there's a good step-by-step guide which has screenshots for everything you need to build an executable jar file.

In particular, did you fill in the "Main Class" property in the project properties? I know you says you've filled in the "Starting form" but that may not be the same thing...

Jon Skeet
i have checked the MAINFEST file there is no line with Main-Class in my Jar file.
Talha Bin Shakir
Well there certainly needs to be. Follow the guide I linked to - specify the Main Class appropriately, and it will be built into the manifest.
Jon Skeet
A: 

Look in the MANIFEST.MF file in the jar file. It should contain a Main-Class line containing the name of the class you want to start when invoking in this manner. If the line is there, doublecheck the spelling of both the class name and Main-Class.

Thorbjørn Ravn Andersen