How To Install Amazon Corretto 11 on Ubuntu 18.04

In this tutorial we learn how to install Amazon Correto 11 on Ubuntu 18.04. We will also learn compiling sample java app to test Java 11 from Amazon Corretto 11.


In this tutorial we learn how to install Amazon Corretto 11 on Ubuntu 18.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 available for Java 8 and Java 11. In this tutorial we learn how to setup Java 11 From Amazon Corretto 11.

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 11 on Ubuntu 18.04 From Repository

Add Amazon Corretto 11 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 11 using command below

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

Compile and Run Java Application Using Amazon Corretto 11

In this section we will create a simple Java application, compile and run using Amazon Corretto 11 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 11.

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


In this tutorial we learn how to install Amazon Corretto 11 on Ubuntu 18.04.

We also learn to create a simple “Hello howtodojo!” program, compile it using javac and run it using java that Amazon Corretto 11 provides. Until next time.