Remember once OpenJDK replaces java JDK

Because the company requires open jdk to be used online, we recently replaced all local java jdk with open jdk. I encountered a small problem in the middle, please record it.

I remember that I received an update from Oracle before, and thought I had replaced it with open jdk at the time. I looked at the environment and found that I was using java jdk, haha.
Insert picture description here
The difference between the two: In
simple terms, OpenJDK is open source, and Java JDK is official, which is Oracle JDK

Installation tutorial of open jdk under linux: http://openjdk.java.net/install/
Download the installation package of open jdk under windows: http://jdk.java.net/

Because I use java jdk8 locally, I chose to install open jdk8
http://jdk.java.net/java-se-ri/8-MR3, but the official website can only find 32-bit open jdk8, open jdk9 and above But you can find 64-bit ones,
Insert picture description here
so in the end I installed 32-bit open jdk8 locally (if you need 64-bit, you may only have to download the source code to compile by yourself)

After downloading, unzip and configure the environment variable JAVA_HOME, and add the following configuration in the path: (open jdk does not need to configure the classpath)
Insert picture description here
Insert picture description here

But when you execute java -version again, you see java jdk instead of open jdk.

After checking the configuration, I found that there is an Oracle jdk path in the path. C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Guess whether it caused the open jdk configuration I set to not be used first, delete it and try again.

Insert picture description here
From the above java environment, you can see that there are two types of virtual machines: Server VM and Client VM

Client VM (-client) is designed and optimized to reduce the startup time in the client environment;
Server VM (-server) is designed to maximize the execution speed of the program in the server environment.

I use it locally, so it’s okay to use Client VM

If you want to change to Server VM, you can also go to the jvm configuration file to modify.

64-bit operating system: the configuration file of jvm is in {JRE_HOME}/lib/amd64/jvm.cfg
32-bit operating system: the configuration file of jvm is in {JRE_HOME}/lib/i386/jvm.cfg

Look at the first line in the jvm.cfg configuration file. If it is -client, the Client VM is used. If it is -server, the Server VM is used. Just change the location.

Insert picture description here

Insert picture description here
As long as -client is deleted, the above warning will not be prompted
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_35448165/article/details/109392723