Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

NoClassDefFoundError

 
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.
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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.
 
eat bricks! HA! And here's another one! And a tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic