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
🌐
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. OpenJDK is an open-source implementation of the Java Platform, OpenJDK comes under Standard Edition licensed – GNU General Public ...
🌐
CyberITHub
cyberithub.com › openjdk-installation-on-centos-7
OpenJDK Installation on CentOS 7 with Easy Steps | CyberITHub
December 26, 2021 - OpenJDK is the official reference implementation of Java SE since version 7. OpenJDK Installation on CentOS 7 is fairly easy and straightforward. Also Read: How to Install Docker Compose on Ubuntu 20.04 LTS [Step by Step] [root@localhost ~]# ...
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

🌐
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 - JAVA_HOME="/usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64/bin/java" ... Note: Learn the difference between .bashrc and .bash_profile. ... Confirm the process by typing Y and pressing Enter. The command above removes all the installed Java instances from the system. To uninstall a specific Java version, add the version number in the command. For example, to remove OpenJDK 11, use the following command: ... This tutorial taught you how to install Java on CentOS and Rocky Linux.
🌐
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.
🌐
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 - java -version openjdk version "11.0.14.1" 2022-02-08 OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1) OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1, mixed mode, sharing) $ ... Download the latest release of JDK 11. curl -L -b "oraclelicense=a" -O https://download.oracle.com/otn-pub/java/jdk/11.0.14+8/7e5bbbfffe8b45e59d52a96aacab2f04/jdk-11.0.14_linux-x64_bin.rpm
🌐
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 - This article will help you to install Java 11 on CentOS 7/6, RHEL 7/6 Linux system. The OpenJDK rpm packages are available under the AppStream repository.
Find elsewhere
🌐
LinuxVox
linuxvox.com › blog › how-to-install-java-on-centos-7
How to Install Java on CentOS 7: A Comprehensive Guide — linuxvox.com
... You’ll see the path you configured. To remove Java, first identify the installed package name: ... Installing Java on CentOS 7 is straightforward with YUM for OpenJDK or RPM for Oracle JDK.
🌐
SysAdminXpert
sysadminxpert.com › home › linux › steps to upgrade java 8 to java 11 on centos 7
Steps To Upgrade Java 8 To Java 11 On CentOS 7 | SysAdminXpert
June 7, 2024 - Set the default Java Compiler alternatives to use Java 11: ... Choose the version corresponding to OpenJDK 11. ... [root@CentOS-7 ~]# java -version 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) [root@CentOS-7 ~]#
🌐
GitHub
gist.github.com › informationsea › a7675756b52c6c179e13e57d16219801
Build OpenJDK 11 for Cent OS 7 · GitHub
Build OpenJDK 11 for Cent OS 7 · Raw · Dockerfile · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
GTX Gaming
gtxgaming.co.uk › home › how to install java on centos 7
How to install Java on Centos 7
December 5, 2023 - Run java -version again to confirm Java 11 is installed. You now have Java installed on your CentOS 7 server and can develop and run Java programs. Let me know if you have any other questions! To install OpenJDK, the open source version of Java, on CentOS 7, follow these steps:
🌐
OpenNMS Community
opennms.discourse.group › knowledge base
Dealing with Java Environments on CentOS and Ubuntu - Knowledge Base - OpenNMS Community
July 2, 2024 - This guide explains how you can ... with a CLI. ℹ For OpenNMS Horizon it is required to have OpenJDK Development Kit installed which is named java-11-openjdk-devel on CentOS and on Ubuntu openjdk-11-jdk....
🌐
Ignite Realtime
discourse.igniterealtime.org › openfire
Openjdk version on centos 7 - Openfire - Ignite Realtime Community Forums
November 27, 2023 - I’m trying to upgrade openfire 4.7.5 to 4.8.0 beta on a CentOS 7 server but it says I need a newer openjdk version. I currently have 1.8.0 but it needs 1.11.0. I tried installing java-11-openjdk-devel (and java -version …
🌐
Server Fault
serverfault.com › questions › 1100072 › centos-7-openjdk-upgrade-confusion
linux - Centos 7 OpenJDK Upgrade Confusion - Server Fault
Their OpenJDK install options include a tar archive. However don't install tar archives to the same place as the rpm. Extract non rpm packages somewhere like /opt that do not affect the system packages. Java 8, 11, and 17 are long term support releases. Reference support roadmap via endoflife.date. At the moment you have a choice from either of them, all are packaged in CentOS and upstream.
🌐
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)