How to Install Oracle JAVA JDK 13 on Ubuntu 18.04 | 16.04

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

Oracle Java 13 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 Java JDK

Download the latest Java SE Development Kit 13 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-13.0.1

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-13.0.1

sudo dpkg -i jdk-13.0.1_linux-x64_bin.deb

After that, run the commands below to configure Java 13 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-13.0.1/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 13 to be the default Java compiler for your Ubuntu desktop…

sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-13.0.1/bin/jar 2
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-13.0.1/bin/javac 2
sudo update-alternatives --set jar /usr/lib/jvm/jdk-13.0.1/bin/jar
sudo update-alternatives --set javac /usr/lib/jvm/jdk-13.0.1/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 "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, 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-13.0.1
export J2REDIR=/usr/lib/jvm/jdk-13.0.1
export PATH=$PATH:/usr/lib/jvm/jdk-13.0.1/bin:/usr/lib/jvm/jdk-13.0.1/db/bin
export JAVA_HOME=/usr/lib/jvm/jdk-13.0.1
export DERBY_HOME=/usr/lib/jvm/jdk-13.0.1/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 should see Java as been installed.

java -version

java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

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

This method installs the original versions from Oracle..


You may also like the post below:


  1. it is showing this error on step 2->cannot access archive ‘jdk-13.0.1_linux-x64_bin.deb’: No such file or directory

    1. You probably downloaded jdk-13.0.2. If so, you’ll have to change the 1 to a 2 in the commands.

  2. Very helpful, 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.