JAVA- multiple versions of the JDK installation configuration

1.7 and 1.8 installation package two versions of the JDK installation package:

  

 

 

 

Normal installation, first install 1.7, and then installed 1.8 (1.7 when installed, there is a place not to modify the path, so the final two versions of the JDK are installed on the C drive)

After completion of the installation path:

  

 

 

   

 

 

   

 

 

Online said that installing the need to configure the environment variables, but I configured, there is no effect, CMD executed "java -version" is still 1.8.

Query information that path: the files under "C \ Program Files (x86) \ Common Files \ Oracle \ Java \ javapath" priority could before JAVA_HOME configuration files,

Final settlement achieved by this way:

1. Go to C: \ Program Files (x86) \ Common Files \ Oracle \ Java \ javapath, you can see only three files:

 

java.exe
javaw.exe
javaws.exe


These three documents are 1.8, real path: C: \ Program Files Java \ under bin \ \ jdk1.8 \ jdk1.8.0_221. Because these files might priority before JAVA_HOME configuration file, so you can find the three files 1.7 to replace these three files.

 

 2. Create a new folder 1.8, these three files to backup at 1.8

 

 3. Enter the installation path 1.7, C: \ Program Files \ Java \ jdk1.7 \ jdk1.7.0_80 \ bin, copy the three files,

     Paste it into C: \ Program Files (x86) \ Common Files \ Oracle \ Java \ javapath

 

 4. Test: the CMD executed "java -version", given:

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

 He said the registry values, versions 1.8 and 1.7 of thing, then look for the registry:

 

 5. CMD in, regedit into the registry, modify the registry values:

Software \ JavaSoft \ the Java Runtime Environment ' \ CurrentVersion 
revised to 1.7

 

6. CMD, perform the "java -version", check the JDK version

  

 

 

 

 7. subsequent handover JDK version of the time, only the following two steps can be:

  1. C: \ Program Files (x86) \ Common Files \ Oracle \ Java \ javapath below the file backup switch, which is used to copy what came out.

  2. The registry Software \ JavaSoft \ Java Runtime Environment '\ CurrentVersion value changes

  

 

 

 

8. IDEA modified:

  Shift + Ctrl + Alt + s recall Project Structure, added with JDK installation path on it.

  

 

 

 

End live.

Guess you like

Origin www.cnblogs.com/yuanyongqiang/p/11831705.html