Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] Netbeans to ant problems

Started by user0 Apr 1, 2011 at 11:02 PM 0 replies 1.1k views
Original Post
user0
user0
This is driving me insane I have a netbeans project that I am trying to compile with ant. I run ant compile or ant jar and it builds successfully but when I go to click on the jar nothing happens and when I run in terminal with java -jar jarname.jar I get Exception in thread "main" java.lang.NoClassDefFoundError

I cant figure out why im getting that and heres the funny part when I run ant run the program works as expected.
Angex
Angex
Sounds like a problem with your manifest.mf.
It's either missing from the jar, or it doesn't point to a class containing a "main" method.

Easiest way to check is open or extract the jar.
Check to see if "Meta-inf/Manifest.mf" exists (This is the default path) and it contains a "Main-Class" property.

If it's missing, you just need to setup the manifest property of the jar task in your ant script.

I'm not too familar with NetBeans, but have a look at, Customizing the Build Script, might be useful.

If you write the scripts manually see, Jar Task.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.