Chapter 3. Updating Java on RHEL 8

The following sections provide instructions for updating Java on RHEL.

3.1. Updating Java on RHEL 8 using yum

The installed Java packages can be updated using the yum system package manager. This requires root privileges.

Procedure

  1. Check the current Java version:

    $ sudo yum list installed "java*"

    A list of installed Java packages appears.

    Installed Packages
    java-1.8.0-openjdk.x86_64                 1:1.8.0.131.b08-0.fc31        @updates
    java-1.8.0-openjdk-headless.x86_64        1:1.8.0.131.b08-0.fc31        @updates
  2. Update a specific package. For example:

    $ sudo yum update java-1.8.0-openjdk

  3. Verify that the update worked by checking the current Java versions:

    # java -version
    openjdk version "1.8.0_242"
    OpenJDK Runtime Environment (build 1.8.0_242-b08)
    OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

3.2. Updating Java on RHEL 8 using an archive

You can update Java using a ZIP bundle. This is useful if the Java administrator does not have root privileges.

Prerequisites

  • Know the generic path pointing to your Java Development Kit (JDK) or Java Runtime Environment (JRE) installation. For example, ~/jdks/java-11

Procedure

  1. Remove the existing symbolic link of the generic path to your JDK or JRE.

    For example:

    $ unlink ~/jdks/java-11

  2. Install the latest version of the JDK or JRE in your installation location.