Install Oracle Java 13 On Ubuntu, Linux Mint Or Debian From APT PPA Repository

Oracle Java logo

Oracle Java 13 was released earlier this month. Debian, Ubuntu, Linux Mint, Pop!_OS and other Debian / Ubuntu-based Linux distribution users can now install it from the Linux Uprising Java PPA. JDK 13 will receive a minimum of two updates, and it will be followed by Oracle JDK 14 in March 2020.

To check out the enhancements in Java 13, visit the release announcement and the release notes.

It's worth reminding you that Oracle Java uses a commercial license (starting wit Oracle Java 11) that allows downloading and using it with no cost for development and testing only, but it requires paying a fee to use it in production! So I recommend using open source JDK builds, like the Zulu OpenJDK or AdoptOpenJDK builds (as a side note, back when I wrote about Zulu OpenJDK, it was the only open source OpenJDK that had repositories for various Linux distributions but since then, AdoptOpenJDK has also added repositories for DEB and RPM based Linux distributions).

The Oracle Java 13 installer is based on the Web Upd8 Java package (so credits go to the original creators) with minor modifications, and it only works on 64bit, since Oracle only offers 64bit downloads.

This installer automatically downloads Oracle JDK 13, runs update-alternatives for the Java binaries and man pages, and it optionally sets Oracle Java 13 as the default Java version (setting JAVA_HOME, etc.). Once Oracle will stop providing public Oracle Java 13 downloads (when it will require users to login to download Oracle Java 13), I will create a new package, like I did for Oracle Java 11 (as long as it's still available, and there are new versions), which will allow you to download the Oracle Java 13 .tar.gz yourself and place it in a folder on your system, then the installer will use that to set everything up.

Also see: How To Install Oracle Java 12 (JDK 12) In Ubuntu, Linux Mint Or Debian (Using PPA).

How to install Oracle Java 13 (JDK 13) on Debian, Ubuntu, Linux Mint, Pop!_OS, etc. using APT repository


Ubuntu / Linux Mint / Pop!_OS, etc.: open a terminal and use these commands to add the Linux Uprising Oracle Java PPA and install Oracle JDK 13 (64bit only!!):

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java13-installer

Debian:

su -

echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee /etc/apt/sources.list.d/linuxuprising-java.list

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A

apt-get update

apt-get install oracle-java13-installer

exit

The oracle-java13-installer package recommends installing oracle-java13-set-default, which makes Oracle Java 13 the default Java. On Ubuntu for example, recommended packages are installed by default, while on Linux Mint that is not the case. Below you can see how to skip installing this package or install it when it's not automatically installed.

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

The default Java version can be checked by using java -version and javac -version, for example:

$ java -version
java version "13" 2019-09-17
Java(TM) SE Runtime Environment (build 13+33)
Java HotSpot(TM) 64-Bit Server VM (build 13+33, mixed mode, sharing)

$ javac -version
javac 13

Downloading Oracle Java 13 manually


In those cases in which you're behind some firewall, router or proxy that prevents the Oracle Java 13 installer from automatically downloading the Java .tar.gz on your system, you can download the Oracle Java 13 .tar.gz file yourself from Oracle on a different computer or the same computer but using a web browser. Make sure the downloaded Oracle Java 13 .tar.gz is the same version as the oracle-java13-installer package!

Once you have the Oracle Java 13 .tar.gz file, place it in /var/cache/oracle-jdk13-installer (create this folder as root if it doesn't exist).

Next, install the oracle-java13-installer package as you would normally (like mentioned above), and the installer will pick up your local Oracle Java 13 archive and use that to set everything up, instead of trying to download the Oracle Java 13 archive from Oracle's servers.

Auto-accepting the Oracle Java 13 license


Want to automatically accept the Oracle Java 13 license? This may be useful for automation, e.g. running the Oracle JDK 13 installer in a script, etc. You can accept the license by using this command:

echo oracle-java13-installer shared/accepted-oracle-license-v1-2 select true | sudo /usr/bin/debconf-set-selections

In case that doesn't work, try ths alternate method:

echo oracle-java13-installer shared/accepted-oracle-licence-v1-2 boolean true | sudo /usr/bin/debconf-set-selections