FaqNoMainClass

Revision as of 22:20, 2 December 2009 by Jglick (Talk | contribs)

I get the error "Failed to load Main-Class manifest attribute" when trying to run a JAR file

You may have created the project as a "class library" instead of as an "application".

To convert it, create a file manifest.mf in the project directory (can just contain Manifest-Version: 1.0 and nothing else), and make sure project.properties contains:

manifest.file=manifest.mf

Then make sure you set a main class for the project in the properties dialog and select Build->Clean and Build Project. The Main-Class attribute, and any required Class-Path, will be inserted into the JAR's manifest by the build process.


Applies to: NetBeans 6.x

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo