This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
why is this happening? i didnt do anything, i only just add a menu bar item and attach an event but this happen. then i undo adding of that menu item, but it still exist.
this error happen in my last project in netbeans 6.9, then i make another project and transfer some components and it works, while i was continuing to add the said
menu item, that error appear.

db there is a package, and MainClass is my main.

java.lang.NoClassDefFoundError: db/MainClass
Caused by: java.lang.ClassNotFoundException: db.MainClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: db.MainClass. Program will exit.
Exception in thread "main" Java Result: 1

any help would be much more appreciated.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10491
    
    9

What the error means is that the jvm is unable to locate the MainClass.class file.
Looks like your netbeans does not know where it is located.

This would be more suitable on the IDE forums. Moving thread.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
looks like the MainClass.class is not there, how to bring it back?

any answer would be much appreciated.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10491
    
    9

I don't know about netbeans, but in Eclipse if you build the project it generates all the class files. Perhaps netbeans has something similar to "build" the project?
Roldan Baldo
Ranch Hand

Joined: Aug 11, 2009
Posts: 99
yes it has build and clean and build, when i clean and build, the class are there, but when i run the program using right clicking on the MainClass node > run, the classes disappear in the folder when i look to it, it gave me the same error.
 
Don't get me started about those stupid light bulbs.
 
subject: NoClassDefFoundError