How To Install Oracle Java 14 (JDK 14) On Ubuntu, Debian Or Linux Mint From APT PPA Repository

Oracle Java logo

[[Edit]] Oracle Java 14 is no longer supported / updated by Oracle, and its latest version is no longer available for download. Please switch to either Oracle Java SE 11 (which is a long term release) or the latest Oracle Java SE 16.

Oracle has released Java 14. Those wanting to install this in Ubuntu, Debian, and Linux distributions based on these, like Pop!_OS, Linux Mint, Zorin OS, etc., can use the Linux Uprising Java PPA. Oracle JDK 14 will receive a minimum of two quarterly updates, before being followed by JDK 15 in September 2020.

Oracle Java 14 includes new features to improve developer productivity, including Java language support for switch expressions, new APIs for continuous monitoring of JDK Flight Recorder data, and extended availability of the low-latency Z Garbage Collector to macOS and Windows. Three preview features are also included: Pattern Matching for instanceof (JEP 305), Records (JEP 359) and Text Blocks (JEP 368).

For more information about Oracle Java 14, see the release announcement and release notes.

Note that I don't recommend installing this, I'm just making it available to those that need it. Oracle Java uses a commercial license starting with Java 11, which allows downloading and using it at no cost for development and testing only, but it requires paying a fee to use it in production. Instead of Oracle Java, you could use open source JDK builds, like those offered by AdoptOpenJDK Or Zulu OpenJDK.

This Oracle Java 14 installer is based on the Web Upd8 Java package (so the credits go to its original creators), with minor modifications, and it does not contain any Oracle Java binaries. Instead, it automatically downloads, installs and optionally sets Oracle Java 14 as the default Java (runs update-alternatives, exports the JAVA_HOME environment variable, etc.) on your system. Only 64bit builds are available.

Also see:


Install Oracle Java 14 (JDK 14) on Ubuntu, Debian, Linux Mint, Pop!_OS, Zorin OS and more using APT PPA repository


Unlike the Oracle Java 11 installer from the same Linux Uprising Oracle Java PPA, which requires users to manually download the Oracle Java .tar.gz and place it in a folder on the system before using the PPA packages, the Oracle Java 14 installer automatically downloads Oracle Java 14 so there's no need to download it manually. In some cases you may need to download it manually though, in case the automatic download fails (the causes for this can be some network settings, proxy or firewall restrictions, etc.), and there are instructions for that further down below.

Ubuntu, Linux Mint, Pop!_OS and other Linux distributions based on Ubuntu: open a terminal and use the commands below to add the Linux Uprising Oracle Java PPA and install Oracle Java 14 (Oracle JDK 14) for 64bit:

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

Debian and other Linux distributions based on Debian but not Ubuntu (without add-apt-repository available by default) users: open a terminal and run the following commands to add the Linux Uprising Oracle Java PPA repository, and install Oracle JDK 14:

su -

echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal 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-java14-installer

exit

This installs Oracle JDK 14. On Linux distributions that automatically install recommended packages (like Ubuntu, but not Linux Mint), oracle-java14-set-default is also installed. This package sets Oracle JDK 14 as the default Java version on your system (runs update-alternatives, exports the JAVA_HOME environment variable, etc.).

In case you want to skip the installation of this package, install Oracle Java 14 with --no-install-recommends, like this:

sudo apt install --no-install-recommends oracle-java14-installer

Or, if you want to install this package in case it's not automatically installed for your (on Linux Mint for example), use:

sudo apt install oracle-java14-set-default

To apply the new JAVA_HOME environment variable, you'll need to logout and log back in.

In case you no longer want Oracle Java 14 to be the default Java version on your Debian / Ubuntu (and Linux Mint, Pop!_OS, Elementary OS, Zorin OS, etc.), remove the oracle-java14-set-default package:

sudo apt remove oracle-java14-set-default

After you install Oracle JDK 14 you can check which Java version is default on your system by using java -version and / or javac -version. Example from my system on which I have installed Oracle JDK 14 (14.0):

$ java -version
java version "14" 2020-03-17
Java(TM) SE Runtime Environment (build 14+36-1461)
Java HotSpot(TM) 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)

$ javac -version
javac 14

Downloading Oracle Java 14 manually in case the installer fails to download it


In case this Oracle Java 14 installer fails to download Oracle JDK 14, e.g. if you're behind some firewall, router or proxy that prevents this installer from downloading it automatically, you can download the Oracle JDK 14 .tar.gz from Oracle, either on the same computer where you want to install it or from some other computer. You'll need to download the same Oracle Java 14 version as the installer version!

Place the downloaded Oracle JDK 14 .tar.gz in /var/cache/oracle-jdk14-installer (create this folder as root if it doesn't exist), then install the oracle-java14-installer package from the Linux Uprising PPA as explained above. Instead of trying to download the Oracle Java 14 .tar.gz archive itself, the installer will use the local version you've downloaded manually.

How to accept the Oracle Java 14 license manually


In case you want to use this Oracle Java 14 installer in some automated scripts, you can manually accept the Oracle JDK 14 license via a command:

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

If that doesn't work, also try this command:

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