Install the OpenJDK JRE

install JRE 11 on Linux using apt

Use this procedure on Ubuntu and other Linux distributions that use .deb files for software installation.

  1. Open a terminal.

  2. Update the system apt package index:

    # apt update

  3. Start the JRE 11 installation:

    # apt install openjdk-11-jre-headless

  4. When prompted to continue, type y and press Return to install JRE 11:

    Do you want to continue? [Y/n]

  5. Confirm the install succeeded:

    $ java -version

    The command should return the version number much as follows:

openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-0ubuntu123.10)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu123.10, mixed mode, sharing)

install JRE 11 on Linux using dnf

Use this procedure on Fedora and other Linux distributions that use .rpm files for software installation.

  1. Open a terminal.

  2. Update the system dnf package index:

    $ dnf update package

    NOTE: This is an abundance-of-caution step and can likely be skipped. Unlike apt, dnf updates its package cache automatically.

  3. Start the JRE 11 installation:

    # dnf install java-11-openjdk.x86_64

  4. When prompted, type y and press Return to install JRE 11:

    Is this ok [y/N]:

  5. Confirm the install succeeded:

    $ java -version

    The command should return the version number much as follows:

openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment (Red_Hat-11.0.21.0.9-1) (build 11.0.21+9)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.21.0.9-1) (build 11.0.21+9, mixed mode, sharing)

install JRE 11 on macOS

  1. Open a terminal.

  2. Check if the Homebrew package manager is installed.

    $ brew -v

    If Homebrew is installed, this command returns a version string something like as follows:
    Homebrew 4.1.21

    If Homebrew is not installed, this command returns an error:
    command not found: brew

  3. If Homebrew is not installed, install it.
    $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  4. Install OpenJDK 11 using HomeBrew.

    $ brew install openjdk@11

  5. Enable macOS Java wrappers to find OpenJDK.

    1. If installed on Intel-based hardware.

      # ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

    2. If installed on Apple Silicon-based hardware.

      # ln -sfn /opt/homebrew/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

  6. Confirm the install succeeded.

    $ java -version

    The command should return the version number much as follows:

openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 11.0.21+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.21+0, mixed mode)

install JRE 11 on Windows

  1. Open a PowerShell instance

  2. Change into the current user's Downloads folder

    cd Downloads

  3. Download Microsoft's OpenJDK 11.0.21 LTS installer for Windows from Download the Microsoft Build of OpenJDK

    Invoke-WebRequest https://aka.ms/download-jdk/microsoft-jdk-11.0.21-windows-x64.msi -OutFile microsoft-jdk-11.0.21-windows-x64.msi

  4. Launch the downloaded installer and follow the on-screen steps.

    Initial window for Microsoft build of OpenJDK 11.0.21 installer

  5. At the Custom Setup step, change the Set JAVA_HOME variable option from Entire feature will be unavailable to Will be installed on local hard drive.

    Custom setup step for Microsoft build of OpenJDK 11.0.21 installer

  6. Confirm the install succeeded by entering the running the following command in a Command prompt window:

    $ java -version

    The command should return the version number much as follows:

openjdk version "11.0.21" 2023-10-17 LTS
OpenJDK Runtime Environment Microsoft-8519785 (build 11.0.21+9-LTS)
OpenJDK 64-Bit Server VM Microsoft-8519785 (build 11.0.21+9-LTS, mixed mode)