Eclipse is not showing compilation errors in project explorer

I am using Eclipse Juno with Java 1.7 and i have created a test project. Now the problem is with project explorer. Project explorer is not showing compilation errors if class have any error. I cleaned, closed , and rebuild the project but nothing is changed. It is still not showing errors in project explorer.It was working fine with Helios.enter image description here

1

13 Answers

As I can see in your project explorer there is a RED exclamation mark over your project name which means there is a problem with the build path in your project. See here for more details.

Check the Build Path of the project by right-clicking the project and selecting Build Path -> Configure Build Path. One problem I often encountered is different people using different Java SDK and so when the exact SDK is not available on your machine, you need to change to your Java SDK (via JRE System Library -> Alternate JRE). A better way to avoid this problem is to always select the JRE System Library from Workspace default JRE or Execution Environment.

0

Have you checked Project/Build Automatically?

1

I had the same problem. I checked the .classpath file of the Eclipse project. It had incorrect value of src so it was pointing to the wrong source of Java files.

My file's incorrect entry:

<classpathentry kind="src" path="src"/>

I changed it to the correct entry:

<classpathentry kind="src" path="source/java"/>

Now, its working :)

2

You can restore the errors to the package explorer by right clicking on an error in the problems pane and selecting show in and then select package explorer.

restoring errors to package explorer

1

Set your build path and java compiler:

Steps:

  1. Right click on the project and go to the properties.
  2. Go to the java build path and set the jre version to the jdk5 or more. (which ever you have to your system).
  3. Go to the java compiler and set java version to the compatible with jre (which ever you set in java build path).
  4. After refreshing the project you may get the compilation error.

Set your Errors/Warnings:

Steps:

1) Right click on the project and go to the properties.
2) Select Java Compiler -> Errors/Warnings.
3) Check the "Enable project specific settings"

In eclipse you can right-click on a project and go Maven-->Update Maven Project and this will tell eclipse to update all of its local project settings (e.g. source and build paths) based upon the current pom.xml.

You must check the build Path configuration to point for the appropriate /src sources java folders, perform a clean up of the eclipse project as well as a maven clean. I had the same issue.

I have faced similar kind of problem in Eclipse Photon. I have cleaned, updated and build the project but nothing was working. Then I figured out that I have disabled problem reporting in preferences. Here is what I did to resolve the issue :

Preferences-->>Editor--> Checked report problems as you type checkbox

Go to the eclipse project -> check the Build Automatically. It will solve the problem. I had the same issue and resolved like this.

Check your class package, it should be under src/main/java, if package differs from that, the compiler will not be able to read class and will not show compilation errors.

I had created a nested project and imported it by doing a refresh, but to get it to be acknowledged as a project that needed to be compiled, I had to also import it as a project:enter image description here

Then, I also had to double click on one of the compilation errors in the "Problems" window to get the errors to also be highlighted in the source code file itself:

enter image description here

I had AspectJ enabled on my project, and that was the source of the issue.

So:

Right click on my project, AspectJ Tools, Remove AspectJ Compatibility. Then add it again with Right click and then Configuration and AspectJ

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like