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

前端 未结 28 1422
予麋鹿
予麋鹿 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:58

    I experienced this when I updated my JDK manually and removed the previous JDK

    Red keywords

    Solution

    • In the IntelliJ editor, click on the red keyword (Integer for example) and press ALT + ENTER (or click the light bulb icon)
    • select Setup JDK from the intentions menu

    IntelliJ intentions menu

    • click on Configure

    Project SDK selection dialog

    • In my case, the JDK path was incorrect (pointed on /opt/jdk1.7.0_51 instead of /opt/jdk1.7.0_65)

    Broken Configure SDK dialog

    • Click on the ... and browse to the right JDK path

    Fixed Configure SDK dialog

    • Let's clear the cache:

    IntelliJ File menu

    And everything should be back to life :)

    No red keywords

提交回复
热议问题