Thursday, 27 October 2022

How to Install Java 19 on Rocky Linux 9

How to Install Java 19 on Rocky Linux 9

In this configuration guide, you will learn how to install Java 19 on Rocky Linux 9.


Table of Contents:


    What is Java?:

    Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities (such as reflection and runtime code modification) that are typically not available in traditional compiled languages. As of 2019, Java was one of the most popular programming languages in use according to GitHub, particularly for client–server web applications, with a reported 9 million developers. (Source: Wikipedia)

    Java was originally developed by James Gosling at Sun Microsystems. It was released in May 1995 as a core component of Sun Microsystems' Java platform. The original and reference implementation Java compilers, virtual machines, and class libraries were originally released by Sun under proprietary licenses. As of May 2007, in compliance with the specifications of the Java Community Process, Sun had relicensed most of its Java technologies under the GPL-2.0-only license. Oracle offers its own HotSpot Java Virtual Machine, however the official reference implementation is the OpenJDK JVM which is free open-source software and used by most developers and is the default JVM for almost all Linux distributions.

    As of September 2022, Java 19 is the latest version, while Java 17, 11 and 8 are the current long-term support (LTS) versions.

    How to Install Java 19 on Rocky Linux 9

    Environment Specification:

    We are using a minimal Rocky Linux 9 virtual machine with following specifications.

    • CPU - 3.4 Ghz (2 cores)
    • Memory - 2 GB
    • Storage - 20 GB
    • Operating System - Rocky Linux release 9.0 (Blue Onyx)
    • Hostname –
    • IP Address -

    We are using a Lenovo - 2022 - IdeaPad 3i - Essential Laptop Computer - Intel Core i5 12th Gen - 15.6" FHD Display - 8GB Memory - 512GB Storage. You can also use the following link to purchase the same at very reasonable price from

    Lenovo Idealpad 3i


    Updating Linux Operating System:

    By following the best practice, update your Linux operating system before installing Java 19 software.

    Login as root user on your Linux server by using a ssh client.

    Refresh your yum cache as follows.

    # dnf makecache
    Rocky Linux 9 - BaseOS                          786  B/s | 3.6 kB     00:04
    Rocky Linux 9 - AppStream                       1.6 kB/s | 3.6 kB     00:02
    Rocky Linux 9 - Extras                          334  B/s | 2.9 kB     00:08
    Metadata cache created.

    Update software packages in your Linux operating system.

    # dnf update -y

    If the above command update your Linux Kernel then, you should reboot your operating system with new Kernel before installing Java 19 software.

    # reboot

    Check the Linux operating system and Kernel versions as follows.

    # cat /etc/rocky-release
    Rocky Linux release 9.0 (Blue Onyx)
    # uname -r


    Installing Java 19 Software:

    Java 19 software is available to download at Oracle website.


    Copy the URL according to your preferred platform and then you can use wget command to download the Java 19 software directly from Linux commandline.

    But first, use following command to install wget utility, if it isn't already installed on your Linux machine.

    # dnf install -y wget

    Now, by using following commands, download Java 19 RPM into /tmp directory.

    # cd /tmp
    # wget
    --2022-10-26 11:34:05--
    Resolving (
    Connecting to (||:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 169483428 (162M) [application/x-redhat-package-manager]
    Saving to: ‘jdk-19_linux-x64_bin.rpm’
    jdk-19_linux-x64_bi 100%[===================>] 161.63M   956KB/s    in 2m 20s
    2022-10-26 11:36:27 (1.16 MB/s) - ‘jdk-19_linux-x64_bin.rpm’ saved [169483428/169483428]

    After successful download, you can invoke dnf command to install Java 19 on Rocky Linux 9.

    # dnf install -y jdk-19_linux-x64_bin.rpm
    Last metadata expiration check: 0:18:02 ago on Wed 26 Oct 2022 11:27:06 AM CDT.
    Dependencies resolved.
     Package       Architecture  Version                  Repository           Size
     jdk-19        x86_64        2000:19.0.1-10           @commandline        162 M
    Transaction Summary
    Install  1 Package
    Total size: 162 M
    Installed size: 318 M
    Downloading Packages:
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Installing       : jdk-19-2000:19.0.1-10.x86_64                           1/1
      Running scriptlet: jdk-19-2000:19.0.1-10.x86_64                           1/1
      Verifying        : jdk-19-2000:19.0.1-10.x86_64                           1/1

    To verify Java 19 installation, execute java command to check the version of active Java software. (Note: You can run multiple versions of Java on a Single Linux operating system with the help of alternatives command.)

    # java --version
    java 19.0.1 2022-10-18
    Java(TM) SE Runtime Environment (build 19.0.1+10-21)
    Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)

    Java 19 software has been successfully installed. Additionally you can set the following Java environment variables.

    # cat << EOF > /etc/profile.d/
    > export JAVA_HOME=/usr/lib/jvm/jdk-19-oracle-x64
    > export PATH=$PATH:$JAVA_HOME/bin
    > EOF



    In this configuration guide, you have learned how to install Java 19 on Rocky Linux 9.

    If you find this article useful? Don't you mind support us by Buy Me A Coffee

    No comments:

    Post a Comment

    © 2022 CentLinux. All Rights Reserved.