IntelliJ gives Fatal Error: Unable to find package java.lang in classpath or bootclasspath

后端 未结 7 1142
悲哀的现实
悲哀的现实 2020-12-02 13:54

When I try to make a simple module in IntelliJ it responds with:

Fatal Error: Unable to find package java.lang in classpath or bootclasspath
7条回答
  •  醉话见心
    2020-12-02 14:31

    This error happend to me after i've updated my JDK version to jdk1.8.0_161 -
    But the project's sdk was still pointing to the old jdk 1.8.0_131

    (Seems that updgrading java causing the previous version to be wiped).

    Do this:

    1. In the IntelliJ IDE go to File > Project Structure, from there:
    2. Within Platform Settings > SDKs:
      Make sure that the JDK Home path field is pointing to a valid JDK folder (add a new entry if needed e.g. jdk1.8.0_161).

    3. Within Project Settings > Modules:
      Make sure that the Module SDK is set to the same entry you picked in the Platform Settings > SDKs

    4. Save & Build again.

提交回复
热议问题