How to set Java SDK path in AndroidStudio?

前端 未结 8 2011
囚心锁ツ
囚心锁ツ 2020-12-08 03:37

I had Java 1.7.0_21 installed and I installed 1.7.0_45 today after uninstalling the previous version. Now Android Studio has stopped compiling projects and says that it cant

8条回答
  •  無奈伤痛
    2020-12-08 04:06

    C:\Program Files\Android\Android Studio\jre\bin>java -version
    openjdk version "1.8.0_76-release"
    OpenJDK Runtime Environment (build 1.8.0_76-release-b03)
    OpenJDK 64-Bit Server VM (build 25.76-b03, mixed mode)
    

    Somehow the Studio installer would install another version under:

    C:\Program Files\Android\Android Studio\jre\jre\bin>java -version
    openjdk version "1.8.0_76-release"
    OpenJDK Runtime Environment (build 1.8.0_76-release-b03)
    OpenJDK 64-Bit Server VM (build 25.76-b03, mixed mode)
    

    where the latest version was installed the Java DevKit installer in:

    C:\Program Files\Java\jre1.8.0_121\bin>java -version
    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
    

    Need to clean up the Android Studio so it would use the proper latest 1.8.0 versions.

    According to How to set Java SDK path in AndroidStudio? one could override with a specific JDK but when I renamed

    C:\Program Files\Android\Android Studio\jre\jre\
    

    to:

    C:\Program Files\Android\Android Studio\jre\oldjre\
    

    And restarted Android Studio, it would complain that the jre was invalid. When I tried to aecify an JDK to pick the one in C:\Program Files\Java\jre1.8.0_121\bin or:

    C:\Program Files\Java\jre1.8.0_121\
    

    It said that these folders are invalid. So I guess that the embedded version must have some special purpose.

提交回复
热议问题