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

🌐
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 - 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)
🌐
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 - In this tutorial, you will learn how to install OpenJDK 11 on CentOS 7. Oracle JDK includes compiler but compiler for OpenJDK 11 is included in openjdk-devel..
🌐
Server World
server-world.info › en › note
CentOS 7 : Install OpenJDK 11 : Server World
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 ·
🌐
Linux Hint
linuxhint.com › centos_install_openjdk
How to Install OpenJDK on CentOS V8 – Linux Hint
When you install OpenJDK, you can set which Java version to use as your default option, including exporting its path to make it available to applications you build on your CentOS 8. For this tutorial, we will install OpenJDK 11 and later set it as our default Java.
🌐
Liquid Web
liquidweb.com › home › help docs › server administration › linux server administration › installing and verifying openjdk 11
How to Install OpenJDK 11 and Configure with Java | Liquid Web
December 15, 2025 - Running transaction Running scriptlet: copy-jdk-configs-3.7-1.el8.noarch 1/1 Running scriptlet: java-11-openjdk-headless-1:11.0.8.10-0.el8_2.x86_64 1/1 … … … Verifying : tzdata-java-2020a-1.el8.noarch 61/63 Verifying : xorg-x11-font-utils-1:7.5-40.el8.x86_64 62/63 Verifying : xorg-x11-fonts-Type1-7.5-19.el8.noarch 63/63 Installed: java-11-openjdk-1:11.0.8.10-0.el8_2.x86_64 java-11-openjdk-devel-1:11.0.8.10-0.el8_2.x86_64 java-11-openjdk-headless-1:11.0.8.10-0.el8_2.x86_64 javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch Complete! [root@host2 ~]# Once the installation is completed, you can verify the installed Java version by running the following command. [root@host2 ~]# 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) [root@host2 ~]#
🌐
Linode
linode.com › docs › guides › how-to-install-openjdk-on-centos-8
How To Install Java Development Kit 11 on CentOS 8 | Linode Docs
March 25, 2020 - Alternatively, if you simply want to run Java applications that you have already downloaded, you can choose to only install OpenJRE 11: ... While you can run Java applications directly with the JRE, your applications will be compiled every time they are executed. This is generally slower than running applications that have already been compiled into Java bytecode, and may not be suitable if you plan to execute applications many times. Check the version of the JRE to verify that it has been properly installed: ... openjdk version "11.0.7" 2020-04-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
Find elsewhere
🌐
Server World
server-world.info › en › note
CentOS Stream 9 : OpenJDK 11 : Install : Server World
This article provides an example of how to install OpenJDK 11 from a package and check its operation on CentOS Stream 9.
🌐
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.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install java 8 & 11 on centos 8
How to Install Java 8 & 11 on Centos 8
August 4, 2025 - Simple tutorial with screenshots on how to install Java on a CentOS 8 server, including the OpenJDK 8, 11, and the Oracle JDK. Get started!
🌐
Medium
medium.com › @redswitches › how-to-install-java-on-centos-8-c1c946730a8a
Step-by-Step Guide to Installing Java (OpenJDK) on CentOS 8
September 19, 2024 - The official CentOS 8 repositories include the latest major Java LTS versions: ... OpenJDK 11.
🌐
Docker Hub
hub.docker.com › r › fabric8 › java-centos-openjdk11-jre
fabric8/java-centos-openjdk11-jre - Docker Image
This image is based on CentOS and provides OpenJDK 11 (JRE) It includes: An Agent Bond⁠ agent with Jolokia⁠ and Prometheus' jmx_exporter⁠. The agent is installed as /opt/agent-bond/agent-bond.jar. See below for configuration options. A startup script /deployments/run-java.sh⁠ for starting ...
🌐
Server World
server-world.info › en › note
CentOS Stream 8 : OpenJDK 11 : Install : Server World
April 12, 2021 - (11) Use External Storage · (12) Active Directory Integration · LVM - LVM Manage · (01) Manage Physical Volumes · (02) Manage Volume Groups · (03) Manage Logical Volumes · (04) Configure Mirroring Volumes · (05) Configure Striped Volumes · Sponsored Link · Matched Content · CentOS Stream 8 : Java · (01) Install OpenJDK 11 ·
🌐
Linuxize
linuxize.com › home › java › how to install java on centos 7
How to Install Java on CentOS 7 | Linuxize
February 24, 2020 - Before starting with the tutorial, make sure you are logged in as root or user with sudo privileges . OpenJDK, the open-source implementation of the Java Platform, is the default Java development and runtime in CentOS 7.
🌐
Linuxize
linuxize.com › home › java › how to install java on centos 8
How to Install Java on CentOS 8 | Linuxize
February 24, 2020 - In this tutorial, we will explain how to install one or more Java (OpenJDK) versions on CentOS 8 and how to set the default Java via alternatives. The general recommendation is to install the latest Java LTS version (JDK 11) version.
🌐
CentOS
centos.org › forums › viewtopic.php
openJDK 11 release? - CentOS
November 3, 2018 - Given that OpenJDK 11 was released a week ago, it's likely to take a while before it ends up in RHEL/CentOS.
🌐
ComputingForGeeks
computingforgeeks.com › home › install java 21 lts (openjdk) on rhel 10 / rocky linux 10 / almalinux 10
Install Java 21 LTS (OpenJDK) on Rocky Linux / AlmaLinux
March 24, 2026 - Java 21 is the latest long-term support (LTS) release from Oracle and the OpenJDK community, with support guaranteed until at least September 2029. If you are running production workloads on RHEL 10, Rocky Linux 10, or AlmaLinux 10, this is ...