Java is a popular programming language for 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.
sudo apt install dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EA8CACC073C3DB2A
Now, add the following PPA to your Debian system. This PPA contains a package oracle-java11-installer having the Java installation script.
echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list
Step 2 – Install Java 11 on Debian 9
Then install Java 11 using the script provided in these packages. This script downloads the Java archive from the official site and configures on your system
sudo apt update sudo apt install oracle-java11-installer
Also, install the following package to configure Java 11 as default Java version on your Debian 9 system.
sudo apt install oracle-java11-set-default
Step 3 – Verify Java Version
Check the installed Java version on your system using the following command.
java -version java version "11.0.2" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
You have successfully installed Java 11.0.1 on Debian 9 Stretch Linux system.