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 a new system variable CLASSPATH:
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
Select system variables: PATH;%JAVA_HOME% \bin;%JAVA_HOME%\jre\bin
jdk version conversion
Convert jdk1.8 to 1.7:
- Environment variable JAVA_HOME:%JAVA7_HOME%;
- 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;
- 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.
Start 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.