On this short tutorial we will learn how to install OpenJDK 8 and Oracle Java 16 on Rocky Linux 8 operating system.
Introduction
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. At the time of writing this article, the latest version of Java is Java 16. On this article we will learn how to install Java 16 including OpenJDK 16 and Oracle Java 16 on Rocky Linux 8 operating system.
But before we start, we are often faced with two Java terminology, namely: OpenJDK and Oracle Java. Don’t be confused, because there are indeed two Java implementations, namely: OpenJDK and Oracle Java. There are almost no differences between them, except Oracle Java has a few additional commercial features.
Prerequisites
Before we are going to install OpenJDK 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 8 On Rocky Linux 8
To install JDK 8 on Rocky Linux 8 server or workstation machine we will use the following command line.
$ sudo dnf install -y java-1.8.0-openjdk-devel
The output :
[ramansah@otodiginet ~]$ sudo dnf install -y java-1.8.0-openjdk-devel [sudo] password for ramansah: Last metadata expiration check: 14:54:07 ago on Fri 13 Aug 2021 06:37:06 AM WIB. Dependencies resolved. ==================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================== Installing: java-1.8.0-openjdk-devel x86_64 1:1.8.0.302.b08-0.el8_4 appstream 9.8 M Installing dependencies: copy-jdk-configs noarch 3.7-4.el8 appstream 26 k java-1.8.0-openjdk x86_64 1:1.8.0.302.b08-0.el8_4 appstream 335 k java-1.8.0-openjdk-headless x86_64 1:1.8.0.302.b08-0.el8_4 appstream 34 M javapackages-filesystem noarch 5.3.0-2.module+el8.3.0+125+5da1ae29 appstream 29 k lksctp-tools x86_64 1.0.18-3.el8 baseos 98 k ttmkfdir x86_64 3.0.9-54.el8 appstream 61 k tzdata-java noarch 2021a-1.el8 appstream 190 k xorg-x11-fonts-Type1 noarch 7.5-19.el8 appstream 521 k Enabling module streams: javapackages-runtime 201801 Transaction Summary ==================================================================================================================== Install 9 Packages Total download size: 45 M Installed size: 160 M Downloading Packages: (1/9): copy-jdk-configs-3.7-4.el8.noarch.rpm 22 kB/s | 26 kB 00:01 (2/9): java-1.8.0-openjdk-1.8.0.302.b08-0.el8_4.x86_64.rpm 53 kB/s | 335 kB 00:06 (3/9): javapackages-filesystem-5.3.0-2.module+el8.3.0+125+5da1ae29.noarch.rpm 30 kB/s | 29 kB 00:00 (4/9): ttmkfdir-3.0.9-54.el8.x86_64.rpm 22 kB/s | 61 kB 00:02 (5/9): tzdata-java-2021a-1.el8.noarch.rpm 17 kB/s | 190 kB 00:11 (6/9): xorg-x11-fonts-Type1-7.5-19.el8.noarch.rpm 22 kB/s | 521 kB 00:24 (7/9): lksctp-tools-1.0.18-3.el8.x86_64.rpm 70 kB/s | 98 kB 00:01 (8/9): java-1.8.0-openjdk-devel-1.8.0.302.b08-0.el8_4.x86_64.rpm 20 kB/s | 9.8 MB 08:23 (9/9): java-1.8.0-openjdk-headless-1.8.0.302.b08-0.el8_4.x86_64.rpm 49 kB/s | 34 MB 11:48 -------------------------------------------------------------------------------------------------------------------- Total 64 kB/s | 45 MB 11:52 warning: /var/cache/dnf/appstream-62ae9a0bbea44fbe/packages/copy-jdk-configs-3.7-4.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 6d745a60: NOKEY Rocky Linux 8 - AppStream 1.6 MB/s | 1.6 kB 00:00 Importing GPG key 0x6D745A60: Userid : "Release Engineering <infrastructure@rockylinux.org>" Fingerprint: 7051 C470 A929 F454 CEBE 37B7 15AF 5DAC 6D74 5A60 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: copy-jdk-configs-3.7-4.el8.noarch 1/1 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.302.b08-0.el8_4.x86_64 1/1 Preparing : 1/1 Installing : lksctp-tools-1.0.18-3.el8.x86_64 1/9 Running scriptlet: lksctp-tools-1.0.18-3.el8.x86_64 1/9 Installing : tzdata-java-2021a-1.el8.noarch 2/9 Installing : ttmkfdir-3.0.9-54.el8.x86_64 3/9 Installing : xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/9 Running scriptlet: xorg-x11-fonts-Type1-7.5-19.el8.noarch 4/9 Installing : javapackages-filesystem-5.3.0-2.module+el8.3.0+125+5da1ae29.noarch 5/9 Installing : copy-jdk-configs-3.7-4.el8.noarch 6/9 Installing : java-1.8.0-openjdk-headless-1:1.8.0.302.b08-0.el8_4.x86_64 7/9 Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.302.b08-0.el8_4.x86_64 7/9 Installing : java-1.8.0-openjdk-1:1.8.0.302.b08-0.el8_4.x86_64 8/9 Running scriptlet: java-1.8.0-openjdk-1:1.8.0.302.b08-0.el8_4.x86_64 8/9 Installing : java-1.8.0-openjdk-devel-1:1.8.0.302.b08-0.el8_4.x86_64 9/9 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.302.b08-0.el8_4.x86_64 9/9 Running scriptlet: copy-jdk-configs-3.7-4.el8.noarch 9/9 Running scriptlet: java-1.8.0-openjdk-1:1.8.0.302.b08-0.el8_4.x86_64 9/9 Running scriptlet: java-1.8.0-openjdk-devel-1:1.8.0.302.b08-0.el8_4.x86_64 9/9 Verifying : copy-jdk-configs-3.7-4.el8.noarch 1/9 Verifying : java-1.8.0-openjdk-1:1.8.0.302.b08-0.el8_4.x86_64 2/9 Verifying : java-1.8.0-openjdk-devel-1:1.8.0.302.b08-0.el8_4.x86_64 3/9 Verifying : java-1.8.0-openjdk-headless-1:1.8.0.302.b08-0.el8_4.x86_64 4/9 Verifying : javapackages-filesystem-5.3.0-2.module+el8.3.0+125+5da1ae29.noarch 5/9 Verifying : ttmkfdir-3.0.9-54.el8.x86_64 6/9 Verifying : tzdata-java-2021a-1.el8.noarch 7/9 Verifying : xorg-x11-fonts-Type1-7.5-19.el8.noarch 8/9 Verifying : lksctp-tools-1.0.18-3.el8.x86_64 9/9 Installed products updated. Installed: copy-jdk-configs-3.7-4.el8.noarch java-1.8.0-openjdk-1:1.8.0.302.b08-0.el8_4.x86_64 java-1.8.0-openjdk-devel-1:1.8.0.302.b08-0.el8_4.x86_64 java-1.8.0-openjdk-headless-1:1.8.0.302.b08-0.el8_4.x86_64 javapackages-filesystem-5.3.0-2.module+el8.3.0+125+5da1ae29.noarch lksctp-tools-1.0.18-3.el8.x86_64 ttmkfdir-3.0.9-54.el8.x86_64 tzdata-java-2021a-1.el8.noarch xorg-x11-fonts-Type1-7.5-19.el8.noarch Complete!
Verify OpenJDK 8 Installation
To verifty our OpenJDK 8 installation, we will use the command line :
$ java -version
The output :
[ramansah@otodiginet ~]$ java -version openjdk version "1.8.0_302" OpenJDK Runtime Environment (build 1.8.0_302-b08) OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)
Conclusion
On this short article we have shown you how to install OpenJDK 8 on Rocky Linux 8 operating system.