[java] 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.

This question is related to java eclipse

The answer is


Try doing a rebuild. I've found that the red x's don't always disappear until a rebuild is done.


So upon finding that there could be a missing package in the buildpath, thus the red x against the main project, to remove this:

1) go into "Configure Buildpath" of project 2) Java Build Path -> Source Tab - you should see the red x against the missing package/file. if it no longer exists, just "remove" it.

red X begone! :)


Try to clean the project and rebuild it.


I also experience those misterious error-symbols on packages from time to time. A way to get rid of them that works for me is to effectively remove the JRE System Library from Java Build Path and add it back again.


To add to the previous answer, an extreme way of "cleaning" your project is to delete it (that is deleting its reference from the workspace, not deleting the actual files), and then re-import it.
Sometimes, it helps...


As others have said, bad file references in the build path is often the culprit.

Usually a .jar file that has been moved/deleted. Eclipse expects to find everything referenced on the build path at the location specified, and will complain if not.


FindBugs also puts a red-x against files/packages to indicate static code analysis errors.


Sometimes there are build path errors in .project, and you need to switch to Resource view to actually see the file that is causing the error.


I have run through this. My case was more involved. The project was packaged fine from maven command line.

Couple of things I made. 1. One class has many imports that confused eclipse. Cleaning them fixed part of the problem 2. One case was about a Setter, pressing F3 navigating to that Setter although eclipse complained it is not there. So I simply retyped it and it worked fine (even for all other Setters)

I am still struggling with Implicit super constructor Item() is undefined for default constructor. Must define an explicit constructor"


Sometimes there are build path errors in .project, and you need to switch to Resource view to actually see the file that is causing the error.


To add to the previous answer, an extreme way of "cleaning" your project is to delete it (that is deleting its reference from the workspace, not deleting the actual files), and then re-import it.
Sometimes, it helps...


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...


Try to clean the project and rebuild it.


Sometimes there are build path errors in .project, and you need to switch to Resource view to actually see the file that is causing the error.


This can occur for a number of reasons. If you have changed the jdk, the Project facet will have a red X next to it while no other folders shows an error. If this is the case, modify the jdk that is shown. This happens on occasion in our JAX-WS class (HSG


Subversion is occasionally the culprit for this as well. It might not have anything to do with your environment. But, there might be a discrepancy between the current and local state of the project. In my case, doing an update, and then a commit to the subversion server provided me with the expected clean result without any flags in the project such as the X.


I've run into a similar problem many a time, what happens usually for me is that a java file will say it won't compile in the text editor but in the package explorer it will say it's compiling fine.

Sometimes doing a 'rebuild' or 'clean-build' doesn't work, the files don't actually get built (one has to presume that eclipse thinks the files it has are up to date) and when this happens I usually open up the java build path and just move one of my dependencies down/up the pecking order. This forces eclipse to do a rebuild of everything and it always seems to work.

If you're still having problems try copying the project and seeing if you get the same behaviour and at a last ditch attempt post a bug for eclipse, it may take a while for them to fix but at least you know that you're being heard.


Sometimes there are build path errors in .project, and you need to switch to Resource view to actually see the file that is causing the error.


As others have said, bad file references in the build path is often the culprit.

Usually a .jar file that has been moved/deleted. Eclipse expects to find everything referenced on the build path at the location specified, and will complain if not.


So upon finding that there could be a missing package in the buildpath, thus the red x against the main project, to remove this:

1) go into "Configure Buildpath" of project 2) Java Build Path -> Source Tab - you should see the red x against the missing package/file. if it no longer exists, just "remove" it.

red X begone! :)


I encountered this problem today and found this link. I followed as mentioned by Patrick Schaefer above and opened the Update Maven project Dialog. Click on my working project and selected the checkbox "Force Update of Snapshots/Releases" and 'Ok'. All the red cross vanished. I hope this helps anybody in a similar situation.


FindBugs also puts a red-x against files/packages to indicate static code analysis errors.


I encountered this problem today and found this link. I followed as mentioned by Patrick Schaefer above and opened the Update Maven project Dialog. Click on my working project and selected the checkbox "Force Update of Snapshots/Releases" and 'Ok'. All the red cross vanished. I hope this helps anybody in a similar situation.


Also, you may update the project by clicking,

Right Click on project name -> Select Maven -> Right click -> Update Project.

This helped out for me.

Thanks.


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


I have run through this. My case was more involved. The project was packaged fine from maven command line.

Couple of things I made. 1. One class has many imports that confused eclipse. Cleaning them fixed part of the problem 2. One case was about a Setter, pressing F3 navigating to that Setter although eclipse complained it is not there. So I simply retyped it and it worked fine (even for all other Setters)

I am still struggling with Implicit super constructor Item() is undefined for default constructor. Must define an explicit constructor"


Try doing a rebuild. I've found that the red x's don't always disappear until a rebuild is done.


I have run through this. My case was more involved. The project was packaged fine from maven command line.

Couple of things I made. 1. One class has many imports that confused eclipse. Cleaning them fixed part of the problem 2. One case was about a Setter, pressing F3 navigating to that Setter although eclipse complained it is not there. So I simply retyped it and it worked fine (even for all other Setters)

I am still struggling with Implicit super constructor Item() is undefined for default constructor. Must define an explicit constructor"


FindBugs also puts a red-x against files/packages to indicate static code analysis errors.


Subversion is occasionally the culprit for this as well. It might not have anything to do with your environment. But, there might be a discrepancy between the current and local state of the project. In my case, doing an update, and then a commit to the subversion server provided me with the expected clean result without any flags in the project such as the X.


i had same problem. I checked "Problems"-Tab and found no server for the project. I defined the server. the red-x disappered


My solution that finally worked was to clean all projects, close eclipse, clean all projects, close eclipse, and so on at least 5-6 times. Eventually it all settled down and everything was as expected. Weirdest thing ever!!

And no there were no errors in the Problem or console view.

Also this happened after a computer crash. The last time it happened my whole workspace was completely lost. It was still there on the computer, but when I tried to access it, it would be all blank.

For whatever reason computer crashes are really really really badly handled by eclipse.


I've run into a similar problem many a time, what happens usually for me is that a java file will say it won't compile in the text editor but in the package explorer it will say it's compiling fine.

Sometimes doing a 'rebuild' or 'clean-build' doesn't work, the files don't actually get built (one has to presume that eclipse thinks the files it has are up to date) and when this happens I usually open up the java build path and just move one of my dependencies down/up the pecking order. This forces eclipse to do a rebuild of everything and it always seems to work.

If you're still having problems try copying the project and seeing if you get the same behaviour and at a last ditch attempt post a bug for eclipse, it may take a while for them to fix but at least you know that you're being heard.


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...


Try to clean the project and rebuild it.


This happened when i downloaded fabric.io on Eclipse Mars but Restarting computer solved this problem for me.


You can go to project-> Buildpath-> Library

If there is any library that is X marked ie [cross marked] removed it and again try to build. It worked for me as well/


Try doing a rebuild. I've found that the red x's don't always disappear until a rebuild is done.


As others have said, bad file references in the build path is often the culprit.

Usually a .jar file that has been moved/deleted. Eclipse expects to find everything referenced on the build path at the location specified, and will complain if not.


I've run into a similar problem many a time, what happens usually for me is that a java file will say it won't compile in the text editor but in the package explorer it will say it's compiling fine.

Sometimes doing a 'rebuild' or 'clean-build' doesn't work, the files don't actually get built (one has to presume that eclipse thinks the files it has are up to date) and when this happens I usually open up the java build path and just move one of my dependencies down/up the pecking order. This forces eclipse to do a rebuild of everything and it always seems to work.

If you're still having problems try copying the project and seeing if you get the same behaviour and at a last ditch attempt post a bug for eclipse, it may take a while for them to fix but at least you know that you're being heard.


I solved mine by

  • Close all other projects (i.e. unrelated project option)

  • Clean and build

My project was android, and that did it.


So upon finding that there could be a missing package in the buildpath, thus the red x against the main project, to remove this:

1) go into "Configure Buildpath" of project 2) Java Build Path -> Source Tab - you should see the red x against the missing package/file. if it no longer exists, just "remove" it.

red X begone! :)


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


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...


Also, you may update the project by clicking,

Right Click on project name -> Select Maven -> Right click -> Update Project.

This helped out for me.

Thanks.


To add to the previous answer, an extreme way of "cleaning" your project is to delete it (that is deleting its reference from the workspace, not deleting the actual files), and then re-import it.
Sometimes, it helps...


Try doing a rebuild. I've found that the red x's don't always disappear until a rebuild is done.


In my case what solved this problem was simply to Close Eclipse and opening it again...However I am still not sure why this happened or why it worked. I was having problems Cleaning my project (it said it could not Delete certain file) and this solved it :):


Right click on the project with errors, then in the sub-menus select: Maven > UpdateProject >

and then:

  • Select the checkbox for all the dependent projects
  • select force update of snapshots
  • click OK.

This worked for me..


I had the same issue and below steps resolved the issue:

  1. Delete the JRE from PROJECT> properties>java build path> libraries.

  2. Restart the eclipse

  3. Add the JRE again

  4. Rebuild the project using Project>Clean and chose option to build automatically.

Please try.


This happened when i downloaded fabric.io on Eclipse Mars but Restarting computer solved this problem for me.


You can go to project-> Buildpath-> Library

If there is any library that is X marked ie [cross marked] removed it and again try to build. It worked for me as well/


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!


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...


As others have said, bad file references in the build path is often the culprit.

Usually a .jar file that has been moved/deleted. Eclipse expects to find everything referenced on the build path at the location specified, and will complain if not.


Right click on the project with errors, then in the sub-menus select: Maven > UpdateProject >

and then:

  • Select the checkbox for all the dependent projects
  • select force update of snapshots
  • click OK.

This worked for me..


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!


I solved mine by

  • Close all other projects (i.e. unrelated project option)

  • Clean and build

My project was android, and that did it.


To add to the previous answer, an extreme way of "cleaning" your project is to delete it (that is deleting its reference from the workspace, not deleting the actual files), and then re-import it.
Sometimes, it helps...


This can occur for a number of reasons. If you have changed the jdk, the Project facet will have a red X next to it while no other folders shows an error. If this is the case, modify the jdk that is shown. This happens on occasion in our JAX-WS class (HSG


I had the same issue and below steps resolved the issue:

  1. Delete the JRE from PROJECT> properties>java build path> libraries.

  2. Restart the eclipse

  3. Add the JRE again

  4. Rebuild the project using Project>Clean and chose option to build automatically.

Please try.


Try to clean the project and rebuild it.


I have run through this. My case was more involved. The project was packaged fine from maven command line.

Couple of things I made. 1. One class has many imports that confused eclipse. Cleaning them fixed part of the problem 2. One case was about a Setter, pressing F3 navigating to that Setter although eclipse complained it is not there. So I simply retyped it and it worked fine (even for all other Setters)

I am still struggling with Implicit super constructor Item() is undefined for default constructor. Must define an explicit constructor"


In my case what solved this problem was simply to Close Eclipse and opening it again...However I am still not sure why this happened or why it worked. I was having problems Cleaning my project (it said it could not Delete certain file) and this solved it :):


FindBugs also puts a red-x against files/packages to indicate static code analysis errors.


I've run into a similar problem many a time, what happens usually for me is that a java file will say it won't compile in the text editor but in the package explorer it will say it's compiling fine.

Sometimes doing a 'rebuild' or 'clean-build' doesn't work, the files don't actually get built (one has to presume that eclipse thinks the files it has are up to date) and when this happens I usually open up the java build path and just move one of my dependencies down/up the pecking order. This forces eclipse to do a rebuild of everything and it always seems to work.

If you're still having problems try copying the project and seeing if you get the same behaviour and at a last ditch attempt post a bug for eclipse, it may take a while for them to fix but at least you know that you're being heard.


i had same problem. I checked "Problems"-Tab and found no server for the project. I defined the server. the red-x disappered


So upon finding that there could be a missing package in the buildpath, thus the red x against the main project, to remove this:

1) go into "Configure Buildpath" of project 2) Java Build Path -> Source Tab - you should see the red x against the missing package/file. if it no longer exists, just "remove" it.

red X begone! :)