This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has sudo access and that you precede each of the privileged commands with sudo

Java is one of the world’s most popular programming language. Java SE 11 is the result of an industry-wide development effort involving open review, weekly builds, and extensive collaboration between Oracle engineers and members of the worldwide Java developer community via the OpenJDK Community and the JCP.

In this tutorial, we will guide you about how to install java 11 JDK/JRE on Debian and Ubuntu.

Installing Java 11

First, you need to download the Java 11 .deb file. To download the latest version CLICK HERE. At this time, java 11.0.4 is the latest version available.

After downloading, put the file into the Home directory of the root user. Then run the following commands.

root@codesposts:~$ dpkg -i jdk-11.0.4_linux-x64_bin.deb

Setting Up Environment Variables

After installing, we need to set the environment variables and the executable files path into your system $PATH variable, by running the below commands.

root@codesposts:~$ vim /etc/profile.d/

Then add the following into the file:

export JAVA_HOME=/usr/lib/jvm/jdk-11.0.2/
export PATH=$PATH:$JAVA_HOME/bin

Now save and exit.

Now, source the file by running the command below:

root@codesposts:~$ source /etc/profile.d/

Verifying The Version

You can verify the Java 11 version installed on your system by running the following command:

root@codesposts:~$ java --version

java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)