Amazon Corretto 8
User Guide

Amazon Corretto 8 Installation instructions for Amazon Linux 2

This topic describes how to install and uninstall Amazon Corretto 8 on a host or container running the Amazon Linux 2 operating system.

Option 1: Use the yum package manager on Amazon Linux.

  1. Enable the yum repository in Amazon Linux 2.

    sudo amazon-linux-extras enable corretto8
  2. You can install Amazon Corretto 8 as either the runtime environment (JRE) or the full development environment (JDK). The development environment includes the runtime environment.

    Install Amazon Corretto 8 as JRE.

    sudo yum install java-1.8.0-amazon-corretto

    Install Amazon Corretto 8 as JDK.

    sudo yum install java-1.8.0-amazon-corretto-devel

    The installation location is /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64.

Option 2: Download and install RPMs manually.

  1. Download the RPMs from the Downloads page. To install the JDK, you will need to download the RPMs for both the JDK and the JRE.

  2. Install using yum localinstall.

    sudo yum localinstall java-1.8.0-amazon-corretto*.rpm

Verify your installation

In the terminal, run the following command to verify the installation.

java -version

Expected output for 8u192:

openjdk version "1.8.0_192" OpenJDK Runtime Environment (build 1.8.0_192-amazon-corretto-preview-b12) OpenJDK 64-Bit Server VM (build 25.192-b12, mixed mode)

If you see a version string that doesn't contain Amazon Corretto, run the following command to change the default java or javac providers.

sudo alternatives --config java

if using the JDK, run as well:

sudo alternatives --config javac

Uninstall Amazon Corretto 8

You can uninstall Amazon Corretto 8 with the following commands.

Uninstall JRE:

sudo yum remove java-1.8.0-amazon-corretto

Uninstall JDK:

sudo yum remove java-1.8.0-amazon-corretto-devel