Updated: 2020-10-09
Java 11 is a LTS version, so should be the most popular version. I tested the steps below on Ubuntu/Mint/Arch.
Installation
Here I will provide three option the Oracle, OpenJDK and AdoptOpenJDK version. I would recommend the AdoptOpenJDK.
AdoptOpenJDK 11 (Recommended)
Ubuntu/Mint
Add the following PPA and install as follow:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo apt install software-properties-common
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt update
sudo apt install adoptopenjdk-11-hotspot
Arch
pacman -S jdk11-adoptopenjdk
OpenJDK 11
Add the following PPA and install as follow:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-11-jdk openjdk-11-source
Oracle Java 11
Add the following PPA and install as follow:
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
Switch between Java versions
List all installed version of Java.
# Ubuntu/Mint/Debian
update-java-alternatives -l
# Arch
archlinux-java status
Selecting new version of Java.
# Ubuntu/Mint/Debian
sudo update-java-alternatives -s java-1.11.0-openjdk-amd64
# Arch
archlinux-java set java-11-adoptopenjdk
Also noted that sometimes the JAVA_HOME is not set and causes issues with few apps. To fix this just set the JAVA home in /etc/enviroment or if that file is not in your distro set in ~/.bashrc. If you are setting in the /etc/enviroment you need to restart to load.
JAVA_HOME="/usr/lib/jvm/java-11-adoptopenjdk"