I downloaded Java 11 in the form of OpenJDK from AdoptOpenJDK. From the tar.gz file I can extract a folder named jdk-11.0.3+7 with nested folders for bin, conf, lib, and so on. But no installer app found there.
➥ How should I install this downloaded Java release onto Ubuntu?
I can cd into the bin folder and execute commands like ./java --version. But I wonder if there is a usual routine for placing the Java implementation somewhere specific, and arranging environment variables, setting default path, etc. On macOS, an installer does all that for me automatically. As I newbie on Ubuntu, I'm uneducated.
Older Questions such as this one ask about using apt-get. My Question is not a duplicate, as here I am asking about downloads from AdoptOpenJDK rather than via package-installer such as apt-get.
1 Answer
AdoptOpenJDK is now superseeded by Adoptium
How to properly install Temurin JDK with update-alternatives
Adoptium provides a Debian / Ubuntu repository
wget -O - | sudo apt-key add -
echo "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-jdkAdoptOpenJDK provides a Debian / Ubuntu repository.
You can install using the package management system, which is much simpler than installing it manually.:
wget -qO - | sudo apt-key add -
sudo add-apt-repository --yes
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 VMYou can switch between e.g. OpenJDK, AdoptOpenJDK and Adoptium by using the following command.:
sudo update-alternatives --config java 1