How to install Amazon Corretto JDK on Ubuntu

In this quick guide, we discuss how to install and setup the latest version of the Amazon Corretto JDK on Ubuntu.

How to install Amazon Corretto JDK on Ubuntu

Amazon Corretto or Corretto for short is a free and open-source distribution of the Open Java Development Kit. Developed by Amazon, Corretto is a cross-platform JDK distribution that is production ready. It comes with security and performance enhancements allowing developers to focus on writing code and not optimizing JDK performance.

Install Corretto 18 with Apt

The first and most common method to install Amazon Corretto JDK is using the apt package manager. Follow the instructions as follows:

  1. Import the Corretto public key and add the repository to the repositories list as:
 wget -O- | sudo apt-key add - 
 sudo add-apt-repository 'deb stable main'
  1. Next, update the system repository:
sudo apt-get update
  1. Install Amazon corretto 18 by running:
sudo apt-get install java-common

Install Corretto 18 with DPKG

If you do not wish to make modifications to the system repository, you can install Corretto using the deb package.

Open the browser and navigate to the corretto downloads page:

  1. Choose the package for your system and copy the download link.
  2. Open the terminal and run the command below to download the corretto installer package
  1. Once downloaded, run the dpkg command to install
sudo dpkg -i amazon-corretto-18-x64-linux-jdk.deb
  1. Once the installation is complete, you can verify by running the command:
java -version
  1. You should see an output as shown below (for corretto 18)
openjdk 18.0.1 2022-04-19
OpenJDK Runtime Environment Corretto- (build 18.0.1+10-FR)
OpenJDK 64-Bit Server VM Corretto- (build 18.0.1+10-FR, mixed mode, sharing)

Uninstalling Amazon Corretto

If you wish to remove the corretto JDK, you can run the dpkg command as shown:

sudo dpkg --remove java-18-amazon-corretto-jdk


And with that, you have successfully installed the latest version (as time of writing) of the Amazon Corretto JDK on your Debian based distribution.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.