Important notice regarding Oracle Java 11 and newer: the Oracle JDK license has changed
starting April 16, 2019. The new license permits certain uses, such as personal use and
development use, at no cost -- but other uses authorized under prior Oracle JDK licenses
may no longer be available.
A FAQ is available here:
https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html .
About Oracle Java 10: This version reached the end of public updates, therefore it's no longer
available for download.
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java13-installer
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java8-set-default
sudo apt install oracle-java10-set-default
To make Oracle Java 13 default, install the "oracle-java13-set-default" in case it wasn't automatically installed by the Oracle Java 13 installer:
sudo apt install oracle-java13-set-default
To skip installing the "oracle-java13-set-default" package when installing oracle-java13-installer, use:
sudo apt install --no-install--recommends oracle-java13-installer
Don't want Oracle Java 13 to be default any more, but want to have it installed? Remove the oracle-java13-set-default package:
sudop apt remove oracle-java13-set-default
You can have multiple Java installations on one server. You can configure which version is the default for use on the command line by using the update-alternatives command.
sudo update-alternatives --config java
You can do this for other Java commands, such as the compiler (javac):
sudo update-alternatives --config javac
sudo update-alternatives --get-selections | grep ^java
sudo apt install openjdk-11-jdk
sudo apt install openjdk-8-jdk