How To Install Amazon Corretto 15 on Ubuntu 20.04

Learn how to install Amazon Corretto 15 on Ubuntu 20.04. a no-cost, multiplatform, production-ready distribution of the OpenJDK.


In this tutorial we learn how to install Amazon Corretto 15 on Ubuntu 20.04. Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK).

It comes with long-term support that includes performance enhancements and security fixes. Corretto is certified as compatible with the Java SE standard and is used internally at Amazon for many production services.

Corretto also available for Java 8, Java 11, and Java 16. In this tutorial we learn how to setup Java 15 From Amazon Corretto 15.

Update Apt Package Index

First of all update apt package index using the command below.

sudo apt-get update

or we can also use apt command below.

sudo apt update

Install Amazon Corretto 15 on Ubuntu 20.04 From Repository

Add Amazon Corretto 15 Public Key

First, we will add Amazon Corretto public key to our system so apt can verify the packages that it download is not corrupt or broken.

wget -O- | sudo apt-key add -

Add Amazon Corretto Repository Configuration

Run the command below to add Amazon Corretto Repository configuration.

echo 'deb stable main' | sudo tee /etc/apt/sources.list.d/corretto.list

Update apt metadata database.

sudo apt-get update

Install Amazon Corretto 15 using command below

sudo apt-get install java-15-amazon-corretto-jdk

Compile and Run Java Application Using Amazon Corretto 15

In this section we will create a simple Java application, compile and run using Amazon Corretto 15 javac and java application.

First, create new file named with contents below

class HelloHowtoDojo {
  public static void main(String[] args) {
      String java_class_path = System.getProperty("java.class.path");
      String java_home = System.getProperty("java.home");
      String java_vendor = System.getProperty("java.vendor");
      String java_vendor_url = System.getProperty("java.vendor.url");
      String java_version = System.getProperty("java.version");
      String os_arch = System.getProperty("os.arch");
      String os_name = System.getProperty("");
      String os_version = System.getProperty("os.version");
      String user_dir = System.getProperty("user.dir");
      String user_home = System.getProperty("user.home");
      String user_name = System.getProperty("");

      System.out.println("Hello howtodojo!");
      System.out.println("Java Class Path :"  + java_class_path);
      System.out.println("Java Home :"  + java_home);
      System.out.println("Java Vendor :"  + java_vendor);
      System.out.println("Java Vendor URL :"  + java_vendor_url);
      System.out.println("Java Version :"  + java_version);
      System.out.println("OS Architecture :"  + os_arch);
      System.out.println("OS Name :"  + os_name);
      System.out.println("OS Version :"  + os_version);
      System.out.println("User Dir :"  + user_dir);
      System.out.println("User Home :"  + user_home);
      System.out.println("User Name :"  + user_name);

Second, compile the source code using command below.


Third, let’s run the application that we just create and compile using Amazon Corretto 15.

$ java HelloHowtoDojo
Hello howtodojo!
Java Class Path :.
Java Home :/usr/lib/jvm/java-15-amazon-corretto
Java Vendor Inc.
Java Vendor URL :
Java Version :15.0.2
OS Architecture :amd64
OS Name :Linux
OS Version :4.15.0-135-generic
User Dir :/home/howtodojo
User Home :/home/howtodojo
User Name :howtodojo


In this tutorial we learn how to install Amazon Corretto 15 on Ubuntu 20.04. We also learn to create a simple “Hello howtodojo!” program, compile it using javac and run it using java that Amazon Corretto provides. Until next time.