How to setup Main class in manifest file in jar produced by NetBeans project
It looks like you are running into a bug in the way NetBeans 6.8 creates the jar for a Java Library Project.
The issue implies that there is a work-around.
I have not been able to verify that with NB 6.8 and/or NetBeans 6.9-dev...
You may want to register with the NetBeans.org website/issue tracker and update the issue and add your 'vote'.
I'm going to make a summary of the proposed solutions and the one that helped me!
After reading this bug report: bug in the way NetBeans 6.8 creates the jar for a Java Library Project.
Create a manifest.mf file in my project root
Edit manifest.mf. Mine looked something like this:
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 16.3-b01 (Sun Microsystems Inc.) Main-Class: com.example.MainClass Class-Path: lib/lib1.jar lib/lib2.jar
Open file /nbproject/project.properties
Add line
manifest.file=manifest.mf
Clean + Build of project
Now the .jar is successfully build.
Thank you very much vkraemer
It is simple.
- Right click on the project
- Go to Properties
- Go to Run in Categories tree
- Set the Main Class in the right side panel.
- Build the project
Thats it. Hope this helps.