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

🌐
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
You can install Red Hat build of OpenJDK Java Runtime Environment (JRE) using the system package manager, yum. ... Logged in as a user with root privileges on the system. Registered your local system to your Red Hat Subscription Management account. See the Registering a system using Red Hat Subscription Management user guide. ... $ java -version openjdk version "11...
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 11 › html › installing_and_using_red_hat_build_of_openjdk_11_on_rhel › installing-openjdk11-on-rhel8
Chapter 2. Installing Red Hat build of OpenJDK 11 on Red Hat Enterprise Linux | Installing and using Red Hat build of OpenJDK 11 on RHEL | Red Hat build of OpenJDK | 11 | Red Hat Documentation
You can install Red Hat build of OpenJDK Java Runtime Environment (JRE) using the system package manager, yum. ... Logged in as a user with root privileges on the system. Registered your local system to your Red Hat Subscription Management account. See the Registering a system using Red Hat Subscription Management user guide. ... $ java -version openjdk version "11...
🌐
Reddit
reddit.com › r/linux4noobs › installing java openjdk 11 on fedora (42)
r/linux4noobs on Reddit: Installing Java OpenJDK 11 on Fedora (42)
May 8, 2025 -

Hello linux4noobs

I downloaded java 11.0.2 tar.gz (I know it is "old" but it's just for my learning purposes) from jdk.java.net/11 and installed it using the "tar" command. The problem is, how do I actually use this java installation?

In windows, I would just add the java /bin directory to the PATH, but I'm unsure how to go about this in Fedora.

I tried to use "update-alternatives --config java" to switch but the 11.0.2 version did not show up as an option. What steps do I need to take to make this the default version in my OS? If it matters, I'm getting into Java programming and that's the reason for installing it.

🌐
IBM
ibm.com › docs › en › oapi › 1.3.6
Installing Java 11 - IBM Documentation
January 3, 2024 - To install Java 11, run the following commands as root: yum install java-11-openjdk update-alternatives --config java · Copy to clipboard · Select the number associated with openjdk 11.
🌐
OpenJDK
openjdk.org › install
OpenJDK: Download and install
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package. On the command line, type: $ su -c "yum install java-1.8.0-openjdk" The java-1.8.0-openjdk package contains just the Java Runtime Environment.
🌐
Oracle
docs.oracle.com › en › java › javase › 11 › install › installation-jdk-linux-platforms.html
4 Installation of the JDK on Linux Platforms - Java
July 15, 2025 - wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 ... Note:Public key installation needs to be done only once. The key installation is persistent across reboots. There are two OL-specific JDK RPM packages, jdk-11-headless and jdk-11-headful. When these packages are installed together, they ...
Find elsewhere
🌐
AWS
docs.aws.amazon.com › corretto › corretto 11 user guide › amazon corretto 11 guide for linux › amazon corretto 11 installation instructions for amazon linux 2 and amazon linux 2023
Amazon Corretto 11 Installation Instructions for Amazon Linux 2 and Amazon Linux 2023 - Amazon Corretto 11
While it is recommended to use ... /etc/alternatives/java_sdk_11_openjdk for JDK. The paths under /etc/alternatives/ may point to another JDK depending on the packages installed and system configuration. Download RPMs from the Downloads page for your CPU architecture. To install the JDK, you will need to download the RPMs for both the JDK and the JRE. Install using yum ...
🌐
JetPatch
kc.jetpatch.com › hc › en-us › articles › 20698538476173-Transitioning-from-Java-8-to-Java-11-for-JetPatch
Transitioning from Java 8 to Java 11 for JetPatch – JetPatch
If not using OpenJDK, then use ... To install this version, first download the .rpm package and then execute: sudo yum localinstall jdk-11.0.22_linux-x64_bin.rpm...
🌐
InMotion Hosting
inmotionhosting.com › inmotion hosting home › support › product guides › vps hosting › how to install java on centos
How to Install Java on CentOS | InMotion Hosting
January 4, 2024 - yum install java-11-openjdk · You may see the following command afterward: There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them.
🌐
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 - Install the OpenJDK 11 development kit, which includes OpenJRE 11: sudo yum install java-11-openjdk-devel · Alternatively, if you simply want to run Java applications that you have already downloaded, you can choose to only install OpenJRE ...
🌐
Medium
hpratap.medium.com › install-java11-on-rhel7-c7727ebedc60
Install Java11 on RHEL7 - Himanshu Pratap - Medium
December 24, 2020 - Install Java11 on RHEL7 Check OS version #cat /etc/redhat-release 2. Enable optional rpm repository (depending upon your os type) #yum-config-manager — enable rhel-7-server-optional-rpms or …
🌐
Qiita
qiita.com › centos7
CentOS 7にOpenJDK 11をインストール(OS標準) #centos7 - Qiita
October 6, 2019 - # cat /etc/redhat-release CentOS Linux release 7.7.1908 (Core) # yum install -y java-11-openjdk which ...
🌐
Simplified
simplified.guide › java › jre-install-redhat
How to install Java Runtime Environment (JRE) on Red Hat, CentOS Stream, and Fedora
Red Hat-family systems need a Java runtime before they can launch packaged JAR files, vendor server applications, and other programs that ship Java bytecode instead of native binaries. Installing the distribution OpenJDK runtime gives the host a supported java command managed by DNF and normal ...
🌐
ARZ Host
arzhost.com › blogs › install-java-11-12-on-centos-7
How To Install Java 11 & 12 On CentOS 7?
October 4, 2023 - On the website, find Java SE 11.0.3 (LTS) and click DOWNLOAD. 3: Use the following command to install the package after the download is finished: use the command sudo yum local install jre-VERSION-linux-x64.rpm
🌐
Jamf
learn.jamf.com › en-US › bundle › technical-articles › page › Installing_Java_and_MySQL_RHEL_Jamf_Pro_10-14-0_or_Later.html
Jamf Learning Hub
Loading application · Your web browser must have JavaScript enabled in order for this application to display correctly
🌐
linux.k2schools.com
linux.r2schools.com › linux.k2schools.com › how to install java jdk 11 on rhel
How to install Java jdk 11 on RHEL | linux.k2schools.com
January 12, 2023 - 1. First, verify java jdk is installed or not using the below command. ... If it asks to download, then type y and hit enter. [administrator@system1 ~]$ sudo yum install java-11-openjdk Updating Subscription Management repositories.