78

For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View.

It is still showing Warnings.

This has suddenly happened and I cannot think of anything that I have changed which would affect this.

I am using the "Maven Integration for Eclipse" plugin but I have been for some time - not sure if this could have affected it or not.

Any ideas?

will
  • 1,175
  • 4
  • 17
  • 20
  • 15
    Your code is almost perfect? – crowne Mar 30 '10 at 07:50
  • i know the answer exactly u can refer the following link, i has answered for this question http://superuser.com/questions/264482/eclipse-not-showing-errors/446518#446518 – JZ.Hunt Jul 09 '12 at 02:08
  • Look at answer below, a build error in a dependency could cause this problem – ZiglioUK Nov 19 '14 at 22:50
  • I and a coworker just had the same problem. Eclipse v4.11. It seems the common element is the m2e plugin and using a maven project. I did a Clean..., removed a brekapoint and after a few minutes the "Java Problems" group returned. – David Balažic Nov 05 '19 at 10:02

28 Answers28

51

I had same problem and randomly did such things as (several times):

1) Project->Clean...,
2) close and open Eclipse again,
3) Run As...

And it started to work again, without changing configuration.

Krzysztof Kot
  • 648
  • 1
  • 10
  • 15
  • Cleaning my projects multiple times as well as refreshing my workspace and restarting Eclipse each time did not resolve my issue. – NobleUplift Aug 07 '14 at 17:28
  • For me it worked after a while automatically , I was looking for answers and when tried to implement it I could not see any error :) great eclipse – Vipin Jan 08 '15 at 07:19
  • 2
    Project ->Clean did it for me. It turned out that I had Project->Build Automatically disabled! – Pierre Apr 09 '15 at 17:59
45

Right-click your project and go to Properties > Java Build Path > Source.

Make sure your source directory (for example MyProject/src) is listed as a Source folder. Otherwise you won't get any red markers.

sanat
  • 1
  • 2
  • 2
  • Thanks, it helps for me. I was not getting error in my test directory's java files(for example MyProject/test), so I added that as a Source folder and it works for me :) – kailash gaur Feb 19 '14 at 06:12
  • Thanks! I was set the Source folders in the wrong way. Now everything works again! – rmbianchi Oct 01 '15 at 12:28
  • If find some other location like project_name/WEB-INF/classes or some thing else then remove that and click on "Add Folder" and add project_name/src. – alok Sep 18 '16 at 14:06
  • This solved my problem. Eclipse is confusing like hell. – tarekahf Nov 30 '22 at 17:30
41

I want to post my story here if Google brings you to this question.

Somehow, "Project->Build Automatically" got turned off.

Turning it back on produces correct errors list.

In my case it has nothing to do with m2e 1.0. This is default behavior for any Java project and goes back as far as Ganymede ( at the point of writing this post I am running Indigo )

Alexander Pogrebnyak
  • 44,836
  • 10
  • 105
  • 121
15

This is not totally an answer to your question, but is related. I thought eclipse stopped showing red/yellow flags next to files in my project. The solution was very simple - I was looking at the Navigator tab (which doesn't show error/warning flags) instead of the Package Explorer tab.

enter image description here

alexey
  • 453
  • 6
  • 15
  • Yes, and it seems that eclipse doesn't show overlays in Navigator anymore – Tertium May 06 '15 at 22:34
  • 1
    This helped me! One possible cause for this (in my case) can be that you are no longer in the Java perspective. Click the "Java" button on the right top of the screen to switch to the Java perspective. – marczoid Mar 24 '16 at 16:07
12

I installed and deinstalled ajdt-plugin and got the same problem.

Check <Project><Properties><Builders>. It should have a 'Java Builder'.

This code should be in the .project file (file is in the root of your project):

<buildSpec>
        <buildCommand>
                <name>org.eclipse.jdt.core.javabuilder</name>
                <arguments>
                </arguments>
        </buildCommand>
</buildSpec>
<natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Kees
  • 1
  • 1
  • 2
  • Ah, this was it! The AJDT (even the dev version for Eclipse 4.4) does not uninstall cleanly. The builder is wrong, so you won't get any errors (and your builds will be outdated). – Kat Jul 21 '14 at 16:16
11
  1. Check your source directory is listed in source folder of project

    • Right-click your project > Build Path > Configure Build Path > Source.
  2. If you are using multiple projects (as dependencies)

    • Project->Clean...,

      enter image description here
  3. Check "Build Automatically" is enabled or not.

    • project > Build Automatically

      enter image description here
Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
10

What worked for me is creating a New Problems View (this option is accessible from the three-dots View options):

screenshot showing 'New Problems View' option

The new View does show all the warnings and errors that were detected:

enter image description here

Gerardo Roza
  • 2,746
  • 2
  • 24
  • 33
4

I was experiencing this problem as well today. The other solutions presented here (such as cleaning the project and restarting Eclipse) did not work or were not applicable to my setup. What did work for me was right-clicking on the project in the Package Explorer and selecting Maven->Update Project Configuration. Evidently some source folder restructuring I had done the previous day had caused Maven to lose track of things, and issuing this command fixed everything.

Psychonaut
  • 859
  • 8
  • 22
3

At the top right corner of the problems window (next to minimize) there is a small arrow-icon. Click it and select "Configure filters". There is a severity filter that might have been activated.

idrosid
  • 7,983
  • 5
  • 44
  • 41
  • This is the correct answer for me. If you just select to see Errors/Warning on Project, there was a dependency that wasn't building and that caused the main project not to be built – ZiglioUK Nov 19 '14 at 22:49
3

I have the same problem in slight different situation. I have a parent POM and multiple modules under it. Project was existing and I imported it into eclipse. I can change the "Dependency management" only to parent project but not projects under it. They are not showing any compilation warnings.

Next I'm going to try to change them all into individual projects... that's not what I wanted, but I haven't been able to solve this otherwise...

prea
  • 1
  • 1
  • Same situation here.. I am having maven multi-module project in svn repository. I am importing it to eclipse. Project runs normally but the console is not displaying any kind of auto-generated log, exceptions and errors etc. We have a doubt that it may because of messing with **sl4j-log4j12** and **logback-classic** dependencies. – Parth Vishvajit Nov 29 '16 at 11:55
2

I have also faced the same problem.

After installing m2eclipse plugin, i was not getting any Java compilation errors.

My solution was to enable dependency management by Select Project -> Right Click (to get context menu) -> m2 Maven -> Enable dependency management.

Now i am able to view Java Compilation Errors.

Santhanam
  • 67
  • 2
  • 6
  • I'm using: Eclipse Classic, SDK Starter Package, ADT Plugin, Android Plugin... to edit JS files. I was not getting messages in the error view. I used your suggestion and it worked! In Eclipse | "Project Explorer" view, "right click" on project name | "Context Menu" appears | select "JS Lint for Java". JS errors and warnings then instantly appeared in the "Problems" view. Yes!!!!! – edt Apr 05 '11 at 15:55
2

This is normal problem. In wich order and export function sometimes get turned off.

right click on project<properties< there u hav option build path < and there ORDER AND EXPORT< click right all the options....all the things are right back.

SCouto
  • 7,808
  • 5
  • 32
  • 49
Shraey
  • 1
  • 1
1

In my case Eclipse wasn't properly picking up a Java project that a current project was dependent on.

You can go to Project > BuildPath > Configure BuildPath and then delete and re-add the project.

John Fisher
  • 22,355
  • 2
  • 39
  • 64
1

There are obviously several reasons why this might occur, and I thought I'd add the solution to my issue. (I have a java project into which I have imported files with virtual links)

If you have a situation like mine, you will have another folder on the same level as your 'src' folder. If you do, right-click on that other folder, then select 'Build Path' > 'Add to Build Path' (if you see 'Build Path' > 'Remove from Build Path', then it had already been added.)

To further configure the Build Path, right click on your top level project dir, and select 'Build Path' > 'Configure Build Path'. Your folders should show up in the 'Source' tab.

To configure what errors you see, Click on Java Compiler > Errors/Warnings and then click 'Configure Workspace Settings'. That is the same as going to Window > Preferences > Java > Compiler > Errors/Warnings. If you don't want Eclipse to ignore something, then just change it to Warning.

MattC
  • 5,874
  • 1
  • 47
  • 40
1

On Ganymede, check the configuration of the Problem view:

('Configure content') It can be set on 'any element in the same project' and you might currently select an element from the project.

Or it might be set on a working set, and this working set has been modified

Make sure that 'Match any configuration' is selected.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

Try following:

  1. Open Problems window (Windows -> Show View -> Problems)

  2. Right click on the error and then Quick Fix

This procedure helped me solve the same problem.

Aleksandar G
  • 1,163
  • 2
  • 20
  • 25
1

If you have reached here that means all the other solutions did not work for you. One reason could be your source folder is not a java project.

Solution would be to run below command on the source folder

mvn eclipse:eclipse

This worked for me.

If this also doesn't work then try removing .classpath and .project file and run the above command again

Mirza
  • 369
  • 1
  • 14
0

I experienced that problem with a MapReduce project. I closed the error window and never came back after doing what the other answers suggested.

Click on the bottom left -> Other -> Problems

enter image description here

gsamaras
  • 71,951
  • 46
  • 188
  • 305
0

Kepler SP2, Java Project (Web Driver), and we use Gradle instead of Maven

None of the above helped, what did fix the problem for me was to select my projects (r-Click) > Gradle > Refresh All

0

Pointing the source(src) folder to the build path will solve this easily to do so right click on the project > build path > configure build path > java build path > source > add folder and click Apply

enter image description here

Tadele Ayelegn
  • 4,126
  • 1
  • 35
  • 30
0

I have the same issue with Eclipse Helios and the m2eclipse plugin. They just can't seem to get this thing to work with WTP or WPT or whatever the blasted acronym is.

If I do a clean on the project and watch the Maven console then I can see the compilation issues in the console but eclipse won't touch it. It seems eclipse or WTP/WPT and m2eclipse are busy playing slap hands.

Justin
  • 859
  • 4
  • 15
  • 30
0

My mistake was that I was creating classes in resource package...

Creating classes in src/main/java solved the issue.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
0

Check your filters, sometimes problem view could be scoped to a working set that you are not currently working in. Also, you can check other configurations for the problem view.

enter image description here

Sagar
  • 5,315
  • 6
  • 37
  • 66
0

Problem in .classpath I did "Replace with HEAD revision" to get back the version that I had in the repository Git and the errors appear again.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '21 at 21:42
0

Duplicates in build path

In my case, errors were not showing up in the Problems View or Package Explorer views because my build path had duplicate entries for src and test directories:

enter image description here

Removing these from Project -> Properties -> Build Path (and just leaving one each) did the trick.

java-addict301
  • 3,220
  • 2
  • 25
  • 37
0

I could reproduce this issue by creating an enumeration with a non-static member class and a static block enumerating its values:

public enum Foo {
Dummy(new Bar [] {new Bar()});
static {
    for (Foo foo: Foo.values());
}
private Foo(Bar [] params) {}
public class Bar {}
 }

This class breaks the Ganymede compiler. If you delete the line in the static initializer block, the code compiles correctly again, and you get the error that there is no enclosing instance for the new Bar() call, as expected.

-- correction: The above holds only if the project has gaeNature from Google Appengine. However, if you get an error similar as mentioned in the original question, you might be encountering another java compiler bug ...

-1

In my case I setted a old workspace and it was the problem.

Try to set a new folder for workspace

-2

If "Debug" has been recently activated then check the top right of the program (under the Minimise button) and click back onto Java.

Jack
  • 1
  • The Problems view will not change its information just because you are viewing it from the Debug perspective. – azurefrog May 08 '14 at 19:58
  • It's no wonder so many people say they "hate Eclipse". I tried it and gave up and went to Netbeans a year ago. Wanting to do an Android project, today I decided to give it another shot and installed Eclipse. I've tried every suggestion above and I STILL can't get errors to display. E.g., `pubic voodoo myMethod(){}` looks fine--no errors. I've changed nothing; just installed the dang thing today and am following tutorial. This is a pretty fundamental and very important thing for so many people to have had all the trouble above. – DSlomer64 Jun 25 '14 at 21:57
  • So I deleted Eclipse and reinstalled and did NOT follow tutorial and used my Netbeans "common sense" to do a "hello world" program and now I DO get errors flagged. SO I guess I should now go back through tutorial and see what they had me do that turned OFF error flagging and report back, in case I can add something other than "reinstall" to the growing list of how to fix lack of error flagging. – DSlomer64 Jun 25 '14 at 22:14