Install Oracle Java 11 on Debian 9 (Stretch)


Java is a popular programming language for the system software development and web application. You need to install the 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 Debian 9 Stretch Linux system.

Step 1 – Prerequsities

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

Step 2 – Download Debian Package

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 Debian 9

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

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 Debian 9 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

After the installation process checks the currently active Java version on your Debian system by running the following command.

Step 5 – Configure Environment Variables

Most of the Java-based applications uses environment variables to work. Create a 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 your file and exit. Now load these setting to current active shell also

You have successfully installed Java 11 on Debian 9 Strech Linux system.