Install AdoptOpenJDK / Adoptium onto Ubuntu

AdoptOpenJDK is now superseeded by Adoptium

How to properly install Temurin JDK with update-alternatives

Adoptium provides a Debian / Ubuntu repository

wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo apt-key add -
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-8-jdk
sudo apt install temurin-17-jdk

AdoptOpenJDK provides a Debian / Ubuntu repository.

You can install using the package management system, which is much simpler than installing it manually.:

wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt update
sudo apt install adoptopenjdk-8-hotspot  # Java 8 / HotSpot VM
sudo apt install adoptopenjdk-8-openj9   # Java 8 / OpenJ9 VM
sudo apt install adoptopenjdk-11-hotspot # Java 11 / HotSpot VM
sudo apt install adoptopenjdk-11-openj9  # Java 11 / OpenJ9 VM
sudo apt install adoptopenjdk-12-hotspot # Java 12 / HotSpot VM
sudo apt install adoptopenjdk-12-openj9  # Java 12 / OpenJ9 VM
sudo apt install adoptopenjdk-13-hotspot # Java 13 / HotSpot VM
sudo apt install adoptopenjdk-13-openj9  # Java 13 / OpenJ9 VM

You can switch between e.g. OpenJDK, AdoptOpenJDK and Adoptium by using the following command.:

sudo update-alternatives --config java