eclipse doesn't compile the project

samsamara picture samsamara · Aug 9, 2012 · Viewed 43.7k times · Source

I had running project opened in eclipse. After an accidental restart of windows, now when I open the eclipse I see my project is marked with a little red cross. Now when I run the main method I get a java.lang.NoClassDefFoundError.

I have tried restarting eclipse, Project -> Clean but it doesn't solve the problem.

When I checked the project directory, inside 'target' folder there are no compiled .class files. I tried building the project but I can't get the compiled class files, which is the reason for the error.

How do I solve this?

Answer

Danny Lagrouw picture Danny Lagrouw · Aug 9, 2012

Maybe Eclipse's workspace files have become corrupted. Restart Eclipse and choose a new workspace folder (or choose Switch workspace from the menu). Then import the project files into a new project.