Install Oracle Java 13 on Ubuntu 18.04 / 16.04 and Debian 10/9

How to install Oracle Java 13 on Ubuntu 18.04 / 19.04 / 16.04 and Debian 10/9/8? Java is a popular programming language created in 1995 for developing mobile, web and desktop applications and more. JDK 13 is an open source reference implementation of the 13th edition of the Java SE platform, specified by JSR 388 in the Java community process. It can be used universally in a production environment.

For CentOS / Fedora, see: How to install Oracle Java 13 (OpenJDK 13) on CentOS 7/8 and Fedora 31/30/29

The Java platform enables you to develop and deploy Java applications on servers, desktops, and IoT devices. This short guide will walk you through the steps required to install Oracle Java 13 on Ubuntu 18.04 / 16.04 and Debian 10/9. Specifically, OpenJDK 13 or Java SE Development Kit 13.

Option 1: Install OpenJDK 13 on Ubuntu 18.04 / 16.04 and Debian 10/9

Visit the JDK 13 version page to download the latest archive.

sudo apt install -y curl
curl -O

Extract the downloaded file using the tar command.

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

Move the results folder to the / opt directory.

sudo mv jdk-13 /opt/

Configure the Java environment:

sudo tee /etc/profile.d/ <

Get your profile and check java command

source /etc/profile.d/

Confirm the Java version.

$ echo $JAVA_HOME

$ java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Option 2: Install Java SE Development Kit 13 on Ubuntu 18.04 / 16.04 and Debian 10/9

The Java SE Development Kit contains a set of tools that developers need to write, compile, run, and debug Java applications.

Update the package list and install wget.

sudo apt update
sudo apt -y install wget

Download the Java SE Development Kit 13.

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

If curl is not for you, download the package manually from the Oracle download page. Then install it using the dpkg command.

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

For any dependency errors, use the following command to resolve them:

sudo apt -f install

Configure the Java environment.

cat <

To check if Java is installed on your computer, type the following command:

$ source /etc/profile.d/
$ java -version
java version "13-ea" 2019-09-17
Java(TM) SE Runtime Environment (build 13-ea+33)
Java HotSpot(TM) 64-Bit Server VM (build 13-ea+33, mixed mode, sharing)

Test Java installation

Create a HelloWorld Java program.

$ cat 
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");


Compile the Java code.

$ javac

Run your Java program.

$ java HelloWorld
Hello, World

More guidance methods:

How to set default Java version on Ubuntu / Debian

Setting JAVA_HOME on CentOS / RHEL / Fedora

How to install Apache Hadoop / HBase on Ubuntu 18.04

How to install Java 8 on Ubuntu 18.04 / 16.04

How to install Apache Hadoop / HBase on CentOS 7