Properly installing java 8 along with java 7

前端 未结 10 1216
无人共我
无人共我 2020-12-04 12:52

I\'ve JDK 1.7 installed on my windows 7 machine and after installing JDK 1.8 u20 I\'m having following error:

C:\\>java -version
Error: Registry key \'Sof         


        
10条回答
  •  醉话见心
    2020-12-04 13:29

    This issue is annoying when dealing with multiple JDKs for developing on Windows 10 (I couldn't make use of the OS system path change as suggested here).

    As a partial answer (since this might not be intended as 'properly' installed) I'm doing quite fine using Cygwin to switch JAVA_HOME and run Maven builds with different JDKs (1.7,1.8) installed (via Oracle installers). So if you have Cygwin installed (or can install and use it) and willing to use JAVA_HOME env variable (useful with Maven as in this example below) you could do like this (BUT be aware of the 'trick' in the answer at link 1 and adjust your local paths accordingly):

    export JAVA_HOME=/cygdrive/c/Progra~1/Java/jdk1.8.0_74
    

    (mvn --version output)

    Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) Maven home: C:\Work2\bin\apache-maven-3.3.9-bin\apache-maven-3.3.9 Java version: 1.8.0_74, vendor: Oracle Corporation Java home: C:\Progra~1\Java\jdk1.8.0_74\jre Default locale: it_IT, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

    export JAVA_HOME=/cygdrive/c/Work2/bin/Java/jdk1.7.0_79_64bit/
    

    (mvn --version output)

    Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00) Maven home: C:\Work2\bin\apache-maven-3.3.9-bin\apache-maven-3.3.9 Java version: 1.7.0_79, vendor: Oracle Corporation Java home: C:\Work2\bin\Java\jdk1.7.0_79_64bit\jre Default locale: it_IT, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows"

    https://stackoverflow.com/questions/14567191/export-java-home-with-spaces-in-cygwin

提交回复
热议问题