Introduction
- This document provides the steps on how to upgrade Java from version 8 to 11
Steps to install OpenJDK 11
Make sure you have the required repositories configured in the server and are up to date
- Check the current Java version using the command
Java –version
2. Install Java Development Kit using the command
sudo yum install java-11-openjdk-devel
3. The package OpenJRE is part of OpenJDK, so this needs to be installed using the command
sudo yum install java-11-openjdk
Steps to Oracle JDK11
Oracle JDK needs to be downloaded as .rpm from its download URL Oracle JDK 11
- Copy the rpm file to the server
- Run command
rpm –ivh jdk-11.0.20_linux-x64_bin.rpm
Set the default Java version to JDK11
Now you have two Java versions running, on the server and need to have the latest to be pointing to the application
- Run the below command to check the installed versions
sudo alternatives --config java
2. The above example shows two selections. 1 for (Java 11) and 2 for (Java 8), In order to change the default to Java 11 type the value as 1 and hit Enter button
Set JAVA_HOME environment variable
The JAVA_HOME environment variable points to the file system location where the JDK or JRE was installed, it helps applications access the Java installation path.
- Run the below command to check the installed path of Java on the server
sudo alternatives --config java
2. Add the path in .bash_profile using an editor
vim .bash_profile
3. Add the below line at the bottom
JAVA_HOME=”<java-install-path>”
In this example it is
JAVA_HOME=” /usr/lib/jvm/java-11-openjdk-11.0.20.0.8-1.el7_9.x86_64/bin/java”
Comments
0 comments
Please sign in to leave a comment.