chance
Don’t read this paragraph if you’re technically involved, it’s purely an inner monologue
Some time ago, the official Minecraft launcher was offline due to unknown reasons. I haven’t played Minecraft for a long time, and my heart is extremely tormented.
Finally, I found another launcher, the pcl launcher , not long ago . This launcher requires a java environment. Is this a coincidence, I just happen to have it. My java environment is 1.8, but Minecraft has been updated to 1.19. The java1.8 environment can only play Minecraft versions below 1.16. I am emo again.
So I went to find Du Niang, and the miraculous Du Niang told me that one computer can install two javas , so I had the next technical harvest.
technology
First install two jdk
My original jdk is 1.8, and I updated it together
Install the jre of jdk17
The newly installed jdk17 does not have jre (it seems that the higher version does not have jre), you need to install it manually
Enter the jdk17 directory and enter cmd to enter the dos window, enter the following content and press Enter.
There is no rebound information after pressing Enter. You can see jre directly by checking the folder
bin\jlink.exe --module-path jmods --add-modules java.desktop --output jre
Configure environment variables
1. Create two new jdk variables
2. Configure JAVA_HOME
Switch the jdk version by configuring the variable value of JAVA_HOME
3. Create a new CLASSPATH variable
Take the following strings as variable values (must be copied in full)
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\bin;
4. Edit the path variable
If there is no path of %JAVA_HOME%\bin, add it. If there is one, click Move Up to move the path of %JAVA_HOME% to the top. (Pro-test, it may not be possible to switch the jdk version without moving up)
After all the above configurations are completed, you can freely switch the jdk version
You only need to edit the variable value of JAVA_HOME to switch the jdk version
So far, two versions of jdk have been installed on one computer and switched freely.