Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError

 
Roldan Baldo
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roldan Baldo
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like the MainClass.class is not there, how to bring it back?

any answer would be much appreciated.
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic