Why so red? IntelliJ seems to think every declaration/method cannot be found/resolved

前端 未结 28 1215
予麋鹿
予麋鹿 2020-12-12 11:22

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

相关标签:
28条回答
  • 2020-12-12 11:49

    I could not get any of these solutions to work for me. I had to manually go to every method/class that I got the error on and import it manually. After that everything was fine.

    0 讨论(0)
  • 2020-12-12 11:50

    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:

    Intellij -> Preferences -> Maven -> Importing
        [ ] Use Maven3 to import projects
    

    I have to check the Maven3 import option and that fixes the issue.

    0 讨论(0)
  • 2020-12-12 11:50

    Yet another solution on IntelliJ Ultimate 2018.2

    • Hover over the import marked red
    • Select dropdown arrow on the popup that appears on left (below)
    • Choose "Add library ... to classpath"

    0 讨论(0)
  • 2020-12-12 11:50

    Resolved by simply "Refresh All Gradle Projects"

    0 讨论(0)
  • 2020-12-12 11:51

    I had the same issue I was using JDK 1.9 with IntelliJ 14, I solved reinstalling Java with latest version of JDK 1.8(1.8.0_161 in this case)

    I also removed the 1.9 version from

    HKEY_CURRENT_USER\Software\JavaSoft\JRE\Security Baseline

    0 讨论(0)
  • 2020-12-12 11:52

    Try to delete the .IntelliJIdea15(depends on version) from C:\Users\Username

    When you start IntelliJ it will create the folder again.

    0 讨论(0)
提交回复
热议问题