windows10 installs jdk1.7,1.8 at the same time

After downloading and installing jdk1.7 and 1.8, how to perform configuration conversion?

Environment variable configuration

Computer Properties - Advanced System Settings - Environment Variables, New Variable
Create three new variables for conversion
Create a new system variable CLASSPATH:
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
Insert image description here
Select system variables: PATH;%JAVA_HOME% \bin;%JAVA_HOME%\jre\bin
Insert image description here

jdk version conversion

Convert jdk1.8 to 1.7:

  1. Environment variable JAVA_HOME:%JAVA7_HOME%;
  2. File replacement: Open the bin directory under the jdk7 installation path, and copy java.exe, javaw.exe, and javaws.exe to the C:\Windows\System32 directory;
  3. Change the registry. When the environment variables are changed and you run java -version, an error
    message may appear
    : 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.
    is because the registry has not been changed.
    Insert image description hereStart menu, search regedit, open the registry - "HKEY_LOCAL_MACHINE" - "SOFTWARE" - "JavaSoft" - "Java Runtime Environment" - "CurrentVersion", right-click to change, change to "1.7" 4.
    Finally Enter java -version in cmd, and the version information of jdk7 can

    be switched. The same goes for 1.7 becoming 1.8.

Notice

When modifying environment variables, delete C:\ProgramData\Oracle\Java\javapath in the PATH value.
At first I followed the appeal steps but was unsuccessful, and found out that this was the problem. The path value is generated when jdk8 is installed and is at the front of Path, so it is useless to modify the registry or environment variables.

Guess you like

Origin blog.csdn.net/layliangbo/article/details/105359260
Recommended