I just did a project…clean and then automatically nothing works.
Exception in thread "main" java.lang.NoClassDefFoundError: adventure/Main
Caused by: java.lang.ClassNotFoundException: adventure.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: adventure.Main. Program will exit.
I can do build but in eclipse there is no output for build and they thought that it is some advantage that you can’t just right-click a file and select compile…
Why did they make Eclipse able to go into this unmanageable state? What is the advantage with this state? If there is no advantage with this state of the project, why is it possible?
I did nothing unusual except experimenting with my build path to be able to generate a runnable JAr which of course failed since eclipse can’t even package a jar correctly.
The code from the class won’t help showing here since it is not found anyway.
Update
I can reproduce this error just by doing a “fresh” SVN checkout and then work on the project and as soon as I use the “function” clean then eclipse automatically destroys my work and makes it impossible to continue the project just because I’m using Eclipse the world’s luosiest IDE ever that they had a decade to developer and this can’t get to do basic function like compile.
I must agree with the comments that it is unlikely this issue was caused by Eclipse. Never the less, assuming it was:
Eclipse works this way because it uses an autobuilder rather than compile after the fact. This can be nice as far as error-catching, but can also be problematic for large projects. As to why a simple manual compile isn’t provided, Eclipse is attempting to hide such development steps as compilation and likely didn’t consider the cases where such errors could occur.
Try turning the autobuild function off and back on again:
Window > Preferences > General > Workspace > Build automatically
If that doesn’t work:
Make a backup of the file containing the class and then delete it. Restore from the backup.
Either of these should force Eclipse to recompile everything.
If that still doesn’t solve your problem, then the error probably wasn’t from Eclipse, it just never had a chance to find it after whatever cleaning you did. Thankfully, by forcing Eclipse to recompile, it should point you at the error.