Java-LogoJava-Logo

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

By admin