How To Install OpenJDK 11 On Rocky Linux 8

On this short tutorial we will learn how to install OpenJDK 11 on Rocky Linux 8 operating system.


Java is one of the most cross-platform, object-oriented, and multipurpose programming language which is mainly used on this age. By using Java, we can create mobile, web, and cloud applications and also we can use Java to create games, chatbots, enterprise applications, and many more. On this article we will learn how to install OpenJDK 11 on Rocky Linux 8 operating system.


Before we are going to install OpenJDK 11 on Rocky Linux 8, there are several prerequisite to be fulfilled, namely :

  • a Rocky Linux 8 server
  • user account with sudo privilege
  • sufficient disk space and good internet connection

Installing OpenJDK 11 On Rocky Linux 8

To install JDK 11 on Rocky Linux 8 server or workstation machine we will use the following command line.

$ sudo dnf install -y java-11-openjdk-devel

Output :

[ramansah@otodiginet ~]$ sudo dnf install -y java-11-openjdk-devel
[sudo] password for ramansah: 
Last metadata expiration check: 1 day, 1:27:29 ago on Fri 13 Aug 2021 06:37:06 AM WIB.
Dependencies resolved.
Package Architecture Version Repository Size
java-11-openjdk-devel x86_64 1: appstream 3.4 M
Installing dependencies:
java-11-openjdk x86_64 1: appstream 260 k
java-11-openjdk-headless x86_64 1: appstream 39 M

Transaction Summary
Install 3 Packages

Total download size: 43 M
Installed size: 177 M
Downloading Packages:
(1/3): java-11-openjdk- 25 kB/s | 260 kB 00:10 A
(2/3): java-11-openjdk-devel- 219 kB/s | 3.4 MB 00:15 
(3/3): java-11-openjdk-headless- 1.0 MB/s | 39 MB 00:38 
Total 994 kB/s | 43 MB 00:44 
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: java-11-openjdk-headless-1: 1/1 
Preparing : 1/1 
Installing : java-11-openjdk-headless-1: 1/3 
Running scriptlet: java-11-openjdk-headless-1: 1/3 
Installing : java-11-openjdk-1: 2/3 
Running scriptlet: java-11-openjdk-1: 2/3 
Installing : java-11-openjdk-devel-1: 3/3 
Running scriptlet: java-11-openjdk-devel-1: 3/3 
Running scriptlet: java-11-openjdk-1: 3/3 
Running scriptlet: java-11-openjdk-devel-1: 3/3 
Verifying : java-11-openjdk-1: 1/3 
Verifying : java-11-openjdk-devel-1: 2/3 
Verifying : java-11-openjdk-headless-1: 3/3 
Installed products updated.

java-11-openjdk-1: java-11-openjdk-devel-1: 

Verify OpenJDK 11 Installation

So far, we have two version of Java (OpenJDK) which is installed on the system. To list and selecting what version of Java that we will use, we have to use the command line :

$ sudo alternatives --config java

Output :

[ramansah@otodiginet ~]$ sudo alternatives –config java

There are 2 programs which provide ‘java’.

Selection Command
*+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-
2 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-

The first Java installed on the system will be the default Java which is used by the system. As shown above, OpenJDK 8 is the defaulf Java on our tutorial machine. To switch over to OpenJDK 11, we just hit ‘+’ on OpenJDK 11.

Enter to keep the current selection[+], or type selection number: 2

To verifty our OpenJDK 11 installation, we will use the command line :

[ramansah@otodiginet ~]$ java -version
openjdk version "11.0.12" 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

OpenJDK 11 is shown after we swicth from OpenJDK 8 to OpenJDK 11.


On this short article we have shown you how to install OpenJDK 11 on Rocky Linux 8.


Add a Comment

Your email address will not be published.