One solution to NoClassDefFoundError for main class
I have seen many reports of "NoClassDefFoundError" so I thought I'd post when I experienced this for the main class. I received this error when I tried to build/run immediately after a project "clean" operation.
Here was my solution.
System: Widnows XP, Eclipse 3.5.1, Java jdk 1.6.
I was able to fix this problem by deleting the .classpath file in the project directory, re-configuring the project java build path properties then rebuilding/running the project. The properties configured for the project were identical to what was there before the clean operation (and what was displayed in the project properties after the clean).
[More information: I had already deleted and recreated the .classpath (thru the IDE properties) once - after copying the project from an OSX environment.
After encountering and fixing the problem as described above, a repeat of the <clean then build> on the Windows system did not produce the error. So, whatever the cause, this is not (reliably) reproducible for the same environment and project. ]