javaeclipse

Why is it acceptable to get NoClassDefFound errors in eclipse? What is the solution?


$##@$%@

Why is it that it seems like when I do searching pertaining to the following error:

java.lang.NoClassDefFoundError: CustomXmlBinding
Caused by: java.lang.ClassNotFoundException: CustomXmlBinding
    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)
Exception in thread "main" 

Which is spit out from eclipse at me after trying to do a clean build, there is no fix? This is also accompanied by an informative popup window that says that no main class could be found, and the program will exit. What happens to cause Eclipse to all of a sudden become corrupt? I am using helios, and it seems like this has occured for some time now. My project has one java file in it, CustomXmlBinding, which has a main method, and has run quite successfully for two days. Today, I did a project clean, tried to run again, and this is what starts happening. The best solution I see on the internet is "make a new workspace" and try again..is that acceptable?


Solution

  • I think I finally figured out what caused this for me - if there is a jar that you have added to your build path, but which has been deleted/renamed/whatever, eclipse loses track of that jar. Instead of complaining that it cant find the required lib or something, it throws this awefully terse message. Hope this helps some other people. I removed the jar from my build path and it worked again.