The Oracle Java 8 and Java 11 required subscription to download and install. So we use OpenJDK for this installation to run Java on CentOS 7/6 and RHEL 7/6 Linux system.. This article will help you to install Java 11 on CentOS 7/6, RHEL 7/6 Linux system.
Step 1 – Search Java Packages
The OpenJDK rpm packages are available under the AppStream repository. Use the following command to search available Java packages under configured yum repositories.
sudo dnf search openjdk
Step 2 – Install Java 11 on CentOS
Now, use one of the following commands to install the required Java version on your CentOS 7/6 and RHEL 7/6 Linux system. You can also install the multiple Java version on any system and use it as per your requirements.
sudo dnf install java-11-openjdk
Step 3 – Check Java Version
Let’s check the installed and current active Java version on your system using the following command:
java -version openjdk version "11.0.4" 2019-07-16 LTS OpenJDK Runtime Environment 18.9 (build 11.0.4+11-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11-LTS, mixed mode, sharing)