How to Manually Install Oracle Java 14 on Ubuntu 18.04 | 16.04

This brief tutorial shows students and new users how to manually install and configure the latest Java JDK 14 on Ubuntu 18.04 | 16.04.

Oracle Java 14 has been released! By the time you have finished reading this post, it might since been upgraded again.. However, you can always get the latest version simply by following the steps below and replacing the version number with the latest.

Since this is a new release, most apps that depend on Java may not yet support it… But you can test it out to see if you environment will support it.

For developers who build apps based on Java, Java JDK and other tools are required during your build process…You can either use Oracle Java or OpenJDK, an open source alternative…

Oracle Java JDK is a development environment for developing applications and tools based on Java… It can also be used for testing applications and program developed using the Java programming language.

There is an open source version of Java JDK ( OpenJDK ) that can be installed easily using the apt-get command…. However, this post is going show you how to download and install Oracle Java from its original repository instead of the open source version…

To get Java JDK installed, follow the steps below:

Step 1: Download Oracle Java JDK

Download the latest Java SE Development Kit 14 LTS release from it from the link below….

Take notes of the version number you’re downloading… If there’s a newer version number then the one below, select it instead.

You can also easily install Java DEB package by running the commands below… At the time of this writing, the current latest version of Java JDK is jdk-14

You may have to replace the version number with the latest as it becomes available..

cd /tmp
wget --no-check-certificate -c --header  "Cookie: oraclelicense=accept-securebackup-cookie" ""

Step 2: Install Oracle Java

Now that you’ve downloaded the correct archive package for your system, run the commands below to install Oracle Java…

Again, the current latest version is jdk-14

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

After installing, you should get a message similar to the one below:

The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 0 B/166 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /tmp/jdk-14_linux-x64_bin.deb jdk-14 amd64 14-1 [166 MB]
Selecting previously unselected package jdk-14.
(Reading database ... 220315 files and directories currently installed.)
Preparing to unpack /tmp/jdk-14_linux-x64_bin.deb ...
Unpacking jdk-14 (14-1) ...
Setting up jdk-14 (14-1) ...

After that, run the commands below to configure Java 14 as the default on Ubuntu… The commands below configure Ubuntu to use Java alternatives….

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-14/bin/java 2
sudo update-alternatives --config java

If you have other versions of Java installed and you ran the commands above, you should see a prompt to select the version of Java you want to make the default.

If you don’t have another versions of Java installed, then the commands will return nothing…

Next, run the commands below to make Java 14 to be the default Java compiler for your Ubuntu desktop…

sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-14/bin/jar 2
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-14/bin/javac 2
sudo update-alternatives --set jar /usr/lib/jvm/jdk-14/bin/jar
sudo update-alternatives --set javac /usr/lib/jvm/jdk-14/bin/javac

That should get Java installed and configured…..

Run the commands below see if Ubuntu recognizes Java..

java -version

You should see the output below:

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)

Step 3: Create Java Environment Variables

To set JAVA environment variables, create a new file in the /etc/profile.d directory for Java JDK…

sudo nano /etc/profile.d/

Then copy and paste the lines into the end of the file and save…

export J2SDKDIR=/usr/lib/jvm/jdk-14
export J2REDIR=/usr/lib/jvm/jdk-14
export PATH=$PATH:/usr/lib/jvm/jdk-14/bin:/usr/lib/jvm/jdk-14/db/bin
export JAVA_HOME=/usr/lib/jvm/jdk-14
export DERBY_HOME=/usr/lib/jvm/jdk-14/db

Next, run the commands below

source /etc/profile.d/

The commands above should configure Java to work and function with Ubuntu. To test if Java is installed correctly, run the commands below.

You can now verify that Java is installed and configured by outputting its home directory.


It should output similar line as below:


Congratulations! You’ve just successfully install Java JDK 14 on Ubuntu 16.04 | 18.04

This method installs the original versions from Oracle..


You may also like the post below:

6 Replies to “How to Manually Install Oracle Java 14 on Ubuntu 18.04 | 16.04”

  1. Yes It works for me 100%. All steps are well briefed and easy to understand. Thank You

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.