Oracle Java 11 has introduced a new, commercial license. It can be downloaded and used without cost only for development and testing. It requires paying a fee if it is used in production. As a result, you should only use Oracle JDK if you intend to pay for it. Oracle JDK builds and OpenJDK builds are essentially identical with a few differences that you can read about here. The JRE is no longer a product and only the JDK will be offered going forward.
So instead of having a single JDK build from Oracle, which can be used either commercially (paid support) or for free (which many of us were doing), they now have two different JDK builds:
Oracle's JDK (commercial) — you can use this in development and testing for free, but if you use it in production, you have to pay for it
Oracle's OpenJDK (open source) — you can use this for free in any environment, like any open source library.
Ubunutu 18.10 has the OpenJDK 11 package in the Ubuntu repositories. Earlier versions of Ubuntu and Linux Mint actually have OpenJDK 10 packaged as the “OpenJDK 11” package. To install the OpenJDK 11 version of Java into all versions of Ubuntu and Linux Mint, use the official Ubuntu PPA:
sudo add-apt-repository ppa:openjdk-r/ppa -y sudo apt update sudo apt install openjdk-11-jdk -y
If you only need the Java JRE, you can install the openjdk-11-jre
package:
sudo apt install openjdk-11-jre -y
If you decide to install the commercial version of Java, you will need to first remove any installed Open JDK packages:
sudo apt purge openjdk*
On Ubuntu or Linux Mint, add the following PPA that hold the scripts to download and install the commercial licensed version:
sudo add-apt-repository ppa:linuxuprising/java -y sudo apt update
On Debian, which prevents “non-free” software, you can manually add the repository with:
echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /tmp/linuxuprising-java.list sudo cp /tmp/linuxuprising-java.list /etc/apt/sources.list.d/ sudo apt install dirmngr -y sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A apt update
Finally, Install Java with the following commands:
echo oracle-java11-installer shared/accepted-oracle-license-v1-2 select true | sudo /usr/bin/debconf-set-selections sudo apt install oracle-java11-installer -y sudo apt install oracle-java11-set-default
Once one of the versions of Java is installed, you can verify that Java is installed with:
java -version
Last Updated: January 10, 2019