In this quick guide, we discuss how to install and setup the latest version of the 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:
- 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'
- Next, update the system repository:
sudo apt-get update
- 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
Open the browser and navigate to the corretto downloads page:
- Choose the package for your system and copy the download link.
- Open the terminal and run the command below to download the corretto installer package
- Once downloaded, run the
dpkgcommand to install
sudo dpkg -i amazon-corretto-18-x64-linux-jdk.deb
- Once the installation is complete, you can verify by running the command:
- You should see an output as shown below (for corretto 18)
openjdk 18.0.1 2022-04-19 OpenJDK Runtime Environment Corretto-220.127.116.11.1 (build 18.0.1+10-FR) OpenJDK 64-Bit Server VM Corretto-18.104.22.168.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
And with that, you have successfully installed the latest version (as time of writing) of the Amazon Corretto JDK on your Debian based distribution.