In Eclipse, what can cause Package Explorer "red-x" error-icon when all Java sources compile without errors?

I'm using Eclipse for Java development. All my sources compile fine and the resulting application compiles fine. However, I keep getting an "red-x" error notification in the Package Explorer.

All my sources in this source directory (too long for the snapshot) compile fine, none of the show the "red-x" error icon.

Any suggestions on how to fix the problem would be highly appreciated.


Solution 1:

yeah, this happens sometimes for no apparent reason. You can go to the "Problems"-Tab (right next to console output) and see the error message, so maybe you can narrow it down that way.

Solution 2:

This happens often when I use Maven, and I had always ignored it until I found this question. You need to update the project in this case (figured this out by looking in the Problems pane)

From the project context menu: Maven -> Update Project and select the available maven codebases

Alternatively you can use (Alt + F5) to bring up the same window

Solution 3:

Try to clean the project and rebuild it.

Solution 4:

After build. Refresh project and if still persist just right click Problems tab in eclipse and choose delete all.

It often happens if you do maven install and eclipse properties files do not get updated properly. Even though your project does not have any errors. Hopefully!

Solution 5:

I want to start by thanking everyone that answered. But cleaning and rebuilding was not enough in my case because the problem was still there and needed fixing.

Turned out that one of my package directories had accidentally been copied so that an extra directory now existed called "Copy of dagskra" containing Java files with wrong package declarations. In addition the errors in this "new" directory don't show up with a "red-x" in the package that it exists in:

Snapshot from Package Explorer showing errorous "Copy of dagskra" directoryr http://www.freeimagehosting.net/uploads/a824304b18.png

It was the hint of reading the "Problems" tab :-) that turned me into the right direction, so I'm selecting that answer as the accepted answer because this is what I needed:

Snapshot from Problems tab http://www.freeimagehosting.net/uploads/dea26d5dd0.png

Hoping this will help others...