Changing OpenJDK8 to OpenJDK11 on CentOS7
Description
I changed java environment from OpenJDK8 to OpenJDK11 and wrote the procedure to do it in here.
The reason I changed OpenJDK version is simply I think OpenJDK8 is a little old and OpenJDK11 is better for me in the future.
Step1 : Checking the existing java version
java -versionopenjdk version “1.8.0_262”
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
Step2 : Removing existing OpenJDK8
We can remove the existing OpenJDK8 environment with “yum remove” command. It’s good way to use wild-card to clean it fully.
sudo yum -y remove java-1.8.0-openjdk*Checking the version again after executing removing.
java -version-bash : /usr/bin/java: No such file or directory
It seemed completed successfully.
Step3 : Installing OpenJDK11
We already removed OpendJDK8, so we begin to install OpenJDK11.
We can also install with yum command as follows.
sudo yum install java-11-openjdkIf runtime environment is enough for your purpose as above. But if you want to use Java as developing, you have to use commands as following.
sudo yum install java-11-openjdk-develYou can select yes or no during installing, please answer them.
After finishing install of the OpenJDK11, you should check the version again.
java -versionopenjdk version “11.0.17” 2022-10-18 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS, mixed mode, sharing)
Installing was completed successfully.
Summary
The procedure to change OpenJDK from 8 to 11.
- Removing OpenJDK8
- After then installing OpenJDK11 with yum command.
