As of November 2020

you can achieve this in 2 steps:

  1. Install Java 11 using yum:

    yum install java-11-openjdk-devel

  2. Get all the Java configurations available in your machine:

    alternatives --config java

    Run the above command, select the version you want to set, I've set 1 here:

    There are 2 programs which provide 'java'.
    Selection    Command
    
    -----------------------------------------------
       1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el7_8.x86_64/bin/java)
    *+ 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/bin/java)
    
    Enter to keep the current selection[+], or type selection number: 1
    
  3. Check java -version:

    openjdk version "11.0.8" 2020-07-14 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode, sharing)
    

Java 11 is now set to be used globally.

Answer from Asad Shakeel on Stack Overflow
Top answer
1 of 2
27

As of November 2020

you can achieve this in 2 steps:

  1. Install Java 11 using yum:

    yum install java-11-openjdk-devel

  2. Get all the Java configurations available in your machine:

    alternatives --config java

    Run the above command, select the version you want to set, I've set 1 here:

    There are 2 programs which provide 'java'.
    Selection    Command
    
    -----------------------------------------------
       1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.8.10-0.el7_8.x86_64/bin/java)
    *+ 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/bin/java)
    
    Enter to keep the current selection[+], or type selection number: 1
    
  3. Check java -version:

    openjdk version "11.0.8" 2020-07-14 LTS
    OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode, sharing)
    

Java 11 is now set to be used globally.

2 of 2
18

The reason, in short, is because someone has to maintain the packages and put these into the repositories your system is using and verify, that they run stable. For example, the OpenJDK 11 on Debian is still in buster (testing) and sid (unstable) and therefore not available in any stable branch. I guess in CentOS (I am not that familiar with it tbh.) it's the same situation.

Sooner or later you'll have to install software without a manager in any OS, so even if you're saying you're a noob, you'll have to learn that sooner or later. And if you want to use openjdk11 now, you'll have to use either an unofficial repository or install the software by hand, what I'd recommend.

However, here is a guide which is the second hit on Google for openjdk11 centos:

curl -O https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.1_linux-x64_bin.tar.gz
mv jdk-11.0.1 /usr/local/

vi /etc/profile.d/jdk11.sh

# create new
export JAVA_HOME=/usr/local/jdk-11.0.1
export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile.d/jdk11.sh

java -version

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

Source: https://www.server-world.info/en/note?os=CentOS_7&p=jdk11&f=2

🌐
SysAdminXpert
sysadminxpert.com › home › linux › how to install openjdk 11 on centos 7
How To Install OpenJDK 11 On CentOS 7 | SysAdminXpert
January 4, 2024 - Install OpenJDK 11: sudo yum install java-11-openjdk-devel · Verify that Java 11 is installed correctly: java -version · This should show you the version of Java that you just installed.
🌐
Medium
medium.com › @prudhviraju.srivatsavaya › installing-openjdk-11-on-centos-using-yum-cadc0276f83a
Installing OpenJDK 11 on CentOS using yum | by Prudhviraju Srivatsavaya | Medium
July 29, 2023 - And if you want to use openjdk11 now, you’ll have to use either an unofficial repository or install the software by hand, what I’d recommend. However, here is a guide which is the second hit on Google for openjdk11 centos: > curl -O https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz > tar zxvf openjdk-11.0.1_linux-x64_bin.tar.gz > mv jdk-11.0.1 /usr/local/ > vi /etc/profile.d/jdk11.sh # Add the below lines to the file export JAVA_HOME=/usr/local/jdk-11.0.1 export PATH=$PATH:$JAVA_HOME/bin > source /etc/profile.d/jdk11.sh > java -version # Java version should display as below openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment 18.9 (build 11.0.1+13) OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
🌐
CyberITHub
cyberithub.com › openjdk-installation-on-centos-7
OpenJDK Installation on CentOS 7 with Easy Steps | CyberITHub
December 26, 2021 - [root@localhost ~]# yum install java-11-openjdk-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in ...
🌐
CentOS Repositories
centos.pkgs.org › 7 › centos-updates-x86_64 › java-11-openjdk-11.0.9.11-0.el7_9.i686.rpm.html
java-11-openjdk-11.0.9.11-0.el7_9.i686.rpm CentOS 7 Download
Install java-11-openjdk rpm package: # yum install java-11-openjdk · 2020-10-15 - Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.9.11-0 - Delay tzdata 2020b dependency until tzdata update has shipped. - Resolves: rhbz#1876665 · 2020-10-15 - Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.9.11-0 ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install java on centos and rocky linux
How to Install Java on CentOS and Rocky Linux
December 16, 2025 - Install it by following the steps ... download is complete, install the package with the command below: sudo yum localinstall [path]/jre-[version]-linux-x64.rpm...
🌐
Server World
server-world.info › en › note
CentOS 7 : Install OpenJDK 11 : Server World
October 17, 2018 - CentOS 7 : JDK 11 · (01) Install JDK 8 · (02) Install OpenJDK 8 · (03) Install JDK 11 · (04) Install OpenJDK 11 · (05) Install Tomcat 8 · (06) Install Tomcat 9 ·
Find elsewhere
🌐
Linuxize
linuxize.com › home › java › how to install java on centos 7
How to Install Java on CentOS 7 | Linuxize
February 24, 2020 - OpenJDK, the open-source implementation ... and runtime in CentOS 7. The installation is simple and straightforward. At the time of writing, OpenJDK 11 is the current LTS version of Java and the recommended version to install. You can install it using yum by typing the following ...
🌐
TecAdmin
tecadmin.net › install-oracle-java-11-lts-on-centos
How To Install Java 11 on CentOS 7/6 & RHEL 7/6 - TecAdmin
April 26, 2025 - So we use OpenJDK for this installation ... you to install Java 11 on CentOS 7/6, RHEL 7/6 Linux system. The OpenJDK rpm packages are available under the AppStream repository. Use the following command to search available Java packages under configured yum repositories....
🌐
ComputingForGeeks
computingforgeeks.com › home › centos › install java 11 on centos 7 / fedora 40/39/38/37
Install Java 11 on CentOS 7 / Fedora 40/39/38/37 | ComputingForGeeks
August 2, 2024 - There are two ways of installing Java 11 on CentOS 7 / Fedora 40/39/38/37 Linux system. ... It is recommended to install OpenJDK 11 because of the license issues around Java SE Development Kit.
🌐
Techoral
techoral.com › blog › java › install-openjdk-on-centos.html
Open Jdk - How To Install OpenJDK On Centos Real Quick
March 22, 2026 - $ sudo yum install java-1.8.0-openjdk-deve1 · OpenJDK Developers Guide · Redhat OpenJDK · AdoptOpenJDK · OpenJDK 11 Download and Installation on Windows · OpenJDK 8 Download and Installation on Windows · OpenJDK 9 Download and Installation ...
🌐
ARZ Host
arzhost.com › blogs › install-java-11-12-on-centos-7
How To Install Java 11 & 12 On CentOS 7?
October 4, 2023 - use the command sudo yum local install jre-VERSION-linux-x64.rpm · The command below displays your current Java release and verifies that the installation was successful: ... If Java was downloaded and installed properly, the output information ...
🌐
DevOpsSchool.com
devopsschool.com › blog › complete-guide-of-java-installation-in-linux
Java Installation Guide in Linux & Windows -
$ sudo apt-get install openjdk-7-jre ... # JDK version Code language: JavaScript (javascript) # Install New Version $ yum install java-11-openjdk-develCode language: PHP (php)...
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 11 › html-single › installing_and_using_red_hat_build_of_openjdk_11_on_rhel › index
Installing and using Red Hat build of OpenJDK 11 on RHEL | Red Hat build of OpenJDK | 11 | Red Hat Documentation
Add the installonlypkgs option in /etc/yum.conf to specify the Red Hat build of OpenJDK packages that yum can install but not update. $ installonlypkgs=java-<version>--openjdk,java-<version>--openjdk-headless,java-<version>--openjdk-devel · Updates will install new packages while leaving the ...
🌐
Linux Hint
linuxhint.com › centos_install_openjdk
How to Install OpenJDK on CentOS V8 – Linux Hint
Once you execute the command, the system will locate the available OpenJDK 11 in the closest mirror to your region, download it and install it. When prompted to authorize the installation, press Y for the installation to proceed. YUM will download the specified OpenJDK and its dependencies.
🌐
Red Hat
developers.redhat.com › openjdk-install
Install OpenJDK on Windows and Linux | Red Hat Developer
January 22, 2024 - Install the OpenJDK 11 package, by running the following command: yum install java-11-openjdk-devel Last updated: January 22, 2024