Revision as of 23:49, 13 December 2011 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:


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, 7.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