Welcome to our guide on how to install Oracle Java 14 / OpenJDK 14 on Ubuntu 20.04/18.04/16.04 & Debian 10/9/ Linux system. Java is a popular programming language used for developing Web, Mobile and Desktop Applications. The Java Platform lets you develop and deploy Java applications on servers, desktops and IoT devices

JDK 14 is the open-source reference implementation of version 14 of the Java SE Platform as specified by by JSR 388 in the Java Community Process. You can read the release notes on JDK 14 to get a view of new and interesting features.

So let’s see how you can install Oracle Java 14 (OpenJDK 14) on Ubuntu 20.04/18.04 & Debian 10/9 Linux system.

Option 1: Install Oracle Java 14 on Ubuntu from PPA repository

The Linux Uprising team provides a PPA repository with pre-built Java binary packages. You can add the repository using the command below.

sudo apt update
sudo add-apt-repository ppa:linuxuprising/java

If you don’t have the add-apt-repository command, check the article on how to add add-apt-repository to Ubuntu / Debian system.

Once the repository is added, proceed to install Oracle Java 14 on Ubuntu Linux.

sudo apt -y install oracle-java14-installer

To set Oracle JDK 14 as default, install the “oracle-java14-set-default” package.

sudo apt -y install oracle-java14-set-default

Confirm your Java version.

$ 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)

Then

Set Java environment.

sudo nano /etc/profile.d/jdk.sh

Add:

export JAVA_HOME=/usr/lib/jvm/java-14-oracle
export PATH=$PATH:$JAVA_HOME/bin

Update your environment:

source /etc/profile.d/jdk.sh

Option 2: Install Oracle Java SE Development Kit 14 on Ubuntu / Debian Linux

If you choose to go with Java SE Development Kit 14, download DEB package for Debian / Ubuntu Linux.

Update your list of packages and install wget.

sudo apt update
sudo apt -y install wget curl

The download the Java SE Development Kit 14 package.

wget --no-check-certificate -c --header  "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/14 36/076bab302c7b4508975440c56f6cc26a/jdk-14_linux-x64_bin.deb"

Then install the DEB package using the apt command:

sudo apt install ./jdk-14_linux-x64_bin.deb

Agree to installation when prompted.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'jdk-14' instead of './jdk-14_linux-x64_bin.deb'
The following additional packages will be installed:
  libasound2 libasound2-data
Suggested packages:
  libasound2-plugins alsa-utils
The following NEW packages will be installed:
  jdk-14 libasound2 libasound2-data
0 upgraded, 3 newly installed, 0 to remove and 53 not upgraded.
Need to get 421 kB/166 MB of archives.
After this operation, 1,824 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Configure Java environment.

cat <<EOF | sudo tee /etc/profile.d/jdk14.sh
export JAVA_HOME=/usr/lib/jvm/jdk-14
export PATH=$PATH:$JAVA_HOME/bin
EOF

To check if you have Java installed on your machine, type the following command:

$ source /etc/profile.d/jdk14.sh
$ 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)

Option 3: Install OpenJDK 14 on Ubuntu 20.04 / 18.04 & Debian 10/9

Visit JDK 14 releases page to download the latest archive.

curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz

Extract the downloaded OpenJDK 14 archive file using tar command.

tar xvf openjdk-14_linux-x64_bin.tar.gz

Move the resulting folder to /opt directory.

sudo mv jdk-14 /opt/

Configure Java environment:

sudo tee /etc/profile.d/jdk14.sh <<EOF
export JAVA_HOME=/opt/jdk-14
export PATH=$PATH:$JAVA_HOME/bin
EOF

Source your profile file and check java command

source /etc/profile.d/jdk14.sh

Confirm Java version.

$ echo $JAVA_HOME
/opt/jdk-14

$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment (build 14 36-1461)
OpenJDK 64-Bit Server VM (build 14 36-1461, mixed mode, sharing)

Kudos!. You’ve successfully install Oracle Java 14 on Debian 10/9 & Ubuntu 20.04/18.04/16.04 Linux machines.

For CentOS / Fedora, refer use:

Install Oracle Java 14 (OpenJDK 14) on CentOS & Fedora