Chapter 3. Updating OpenJDK 8 on RHEL

3.1. Updating OpenJDK on RHEL using yum

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

Prerequisite

  • You must have root privileges on the system.

Procedure

  1. Check the current OpenJDK version:

    $ sudo yum list installed "java*"

    A list of installed OpenJDK packages appears.

    Installed Packages
    java-1.8.0-openjdk.x86_64           1:1.8.0.242.b08-0.el8_1     @rhel-8-appstream-rpms
    java-1.8.0-openjdk-headless.x86_64  1:1.8.0.242.b08-0.el8_1     @rhel-8-appstream-rpms
  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 OpenJDK 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 OpenJDK on RHEL using an archive

You can update OpenJDK using an archive. This is useful if the OpenJDK administrator does not have root privileges.

Prerequisites

  • Know the generic path pointing to your OpenJDK or JRE installation. For example, ~/jdks/java-8

Procedure

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

    For example:

    $ unlink ~/jdks/java-8

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