Development

How to install Amazon Corretto JDK on Ubuntu

Captain Salem 2 min read

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.

In this tutorial, we will cover how to install the latest version of the Amazon Corretto JDK on Ubuntu and any Ubuntu Based distribution.

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- https://apt.corretto.aws/corretto.key | sudo apt-key add - 
 sudo add-apt-repository 'deb https://apt.corretto.aws 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.

  1. Open the browser and navigate to the corretto downloads page:https://docs.aws.amazon.com/corretto/latest/corretto-18-ug/downloads-list.html
image-20220712122120003
image-20220712122120003
  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
wget https://corretto.aws/downloads/latest/amazon-corretto-18-x64-linux-jdk.deb
image-20220712122532615
image-20220712122532615
  1. Once downloaded, run the dpkg command to install
sudo dpkg -i amazon-corretto-18-x64-linux-jdk.deb
image-20220712122618438
image-20220712122618438
  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-18.0.1.10.1 (build 18.0.1+10-FR)
OpenJDK 64-Bit Server VM Corretto-18.0.1.10.1 (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

Closing

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

Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.