Install Oracle Java 11 on Ubuntu


Java is a popular programming language for the system software development and web application. You need to install Java Development Kit (JDK) and Java Runtime Environment (JRE) for the setup of the Java development environment. JDK compiled the source java file and make a java class file. JRE is used to run that intermediate class file. This tutorial will guide you to install Oracle Java 11 LTS version on Ubuntu 16.04 LTS Xenial system.

Step 1 – Prerequsities

Before beginning the installation login to shell as the sudo user and install some required packages.

Step 2 – Download Java 11

Download the latest Java SE Development Kit 11 LTS debian file release from its official download page or use following commands to download from command line.

Step 3 – Install Java 11 on Ubuntu 16.04

Use default Debian package installer (dpkg) to install downloaded Java on your system. Simply execute the following command on terminal

Then configure Java 11 as the default version on your system.

Install java 11 Ubuntu 16.04

According to the above screenshot, there are 3 versions installed. Java 11 is listed on number 3, So entered 3 and press Enter. Now Java 11 is installed as default Java version on my Ubuntu 16.04 system.

There are some other binaries to set as default for JDK installation. Execute the commands to set javac and jar as default:

Step 4 – Verify Java Version

Now check the installed Java version on your system using the following command.

Step 5 – Setup Java Environment Variables

Most of the Java-based applications uses environment variables to work. Create an script as below. Now set all the required environment variables for Java. This file will automatically reload settings on system reboot.

Add/Update following values:

Save you file and exit. Now load these setting to current active shell also

You have successfully installed Java 11 on Ubuntu  system.