I just installed and re-installed IntelliJ. Every Java file is coming up RED. I checked the JDK; it is at 1.6.##. The maven clean install
build worked just fine.
I'm getting the usual highlighted errors. On every declaration:
Cannot resolve symbol SomeEntityBean/Bean
and on every method:
Cannot resolve method SomeFunction()
How do I fix these false errors?
In my case, getter and setter dependencies were coming through lombok plugin (Using java with Spring). And in the new installation of intellij idea, I had not installed the lombok plugin. Installing the lombok plugin fixed it for me.
I had this problem on a fresh install of IDEA. I thought it had brought its own JDK or would be able to find the one already on the machine, but apparently not (not sure what the checkbox in the install dialog did, now). When I clicked on the lightbulb and clicked the "Setup JDK" button and then clicked "Configure," it revealed that it was trying to get the JDK from
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1\jre64
I browsed around, trying a few folders in the JetBrains tree, but at least the dialog was smart enough not to let me apply any (including the original), saying they were not valid locations for a JDK. So I browsed over to the Java tree and tried that, and it accepted this:
C:\Program Files\Java\jdk1.8.0_40
After I OK'ed the config, it didn't appear to have worked; so I went to try invalidating the IDEA cache and restarting (as described in other answers), and it told me that I had background tasks running. So I canceled out of the invalidation, and while I was doing that, whatever recompilation or database updating it was doing completed, and all the red in the edit window went away. So it takes a few seconds (at least) for the JDK config to settle out.
Yet another solution on IntelliJ Ultimate 2018.2
I have IntelliJ IDEA 12.x on the Mac and I use Maven 3 and I get the red highlighting over my code even though the Maven build is fine. None of the above (re-indexing, force import, etc.) worked for me. I had to do the following:
I have to check the Maven3 import option and that fixes the issue.
IntelliJ sometime gets confused after importing maven projects and then changing poms externally or generating sources outside IntelliJ.
You might want to try a maven->force reimport from within intellij on the project root
I experienced this when I updated my JDK manually and removed the previous JDK
Solution
Integer
for example) and press ALT + ENTER (or click the light bulb icon)Configure
/opt/jdk1.7.0_51
instead of/opt/jdk1.7.0_65
)And everything should be back to life :)