Getting "cannot find Symbol" in Java project in Intellij

I make this call to a static singleton instance from the class GameManager.java.

HUD.getInstance().update(timeDelta);

HUD.java contains the HUD class as well as two other related classes, HUDTextElement and HUDElement. All the classes are in the same root path ../src/org/mypackage.

However, when compiling this java project in IntelliJ I get cannot find Symbol HUD on the line I make the HUD.getInstance() call.

This exact same code compiles just fine in eclipse, any idea what the problem is?


Select Build->Rebuild Project will solve it


I had the same problem and fixed it by clicking File>Invalidate caches/ restart


I had the same problem, and turns out I had never completely compiled the fresh project. So right-clicking and selecting Compile'' (shift-cmd-F9 on mac) fixed it. It seems the compile on save does not 'see' non-compiled files.

Marking the src folder as source did not help in my case.


This is likely to be your ../src folder is not marked as a "source" folder in Intellij IDEA, so it doesn't know to look there to find your class. You can right click the folder in the project explorer and choose "mark as source folder" to fix this.


I was getting the same "cannot find symbol" error when I did Build -> Make Project. I fixed this by deleting my Maven /target folder, right clicking my project module and doing Maven -> Reimport, and doing Build -> Rebuild Project. This was on IntelliJ Idea 13.1.5.

It turns out the Maven -> Reimport was key, since the problem resurfaced a few times before I finally did that.