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.
Happy coding!
7 Comments
Thanks you! I successfully installed Java 14 on my machine!
Indeed, better install java11 from “stretch-backports” repository.
Not work out of the box. Need manual downloading!
# apt install oracle-java11-installer-local
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
binutils java-common
…
Fetched 3,818 kB in 0s (6,488 kB/s)
Preconfiguring packages …
Selecting previously unselected package binutils.
(Reading database … 33861 files and directories currently installed.)
Preparing to unpack …/binutils_2.28-5_amd64.deb …
Unpacking binutils (2.28-5) …
Selecting previously unselected package java-common.
Preparing to unpack …/java-common_0.58+deb9u1_all.deb …
Unpacking java-common (0.58+deb9u1) …
Setting up binutils (2.28-5) …
Selecting previously unselected package oracle-java11-installer-local.
(Reading database … 34187 files and directories currently installed.)
Preparing to unpack …/oracle-java11-installer-local_11.0.3-1~linuxuprising2_amd64.deb …
Unpacking oracle-java11-installer-local (11.0.3-1~linuxuprising2) …
Processing triggers for mime-support (3.60) …
Setting up java-common (0.58+deb9u1) …
Processing triggers for libc-bin (2.24-11+deb9u4) …
Processing triggers for man-db (2.7.6.1-2) …
Setting up oracle-java11-installer-local (11.0.3-1~linuxuprising2) …
Before installing this package,
please download the Oracle JDK 11 .tar.gz file
with the same version as this package,
and place it in /var/cache/oracle-jdk11-installer-local,
E.g.:
sudo mkdir -p /var/cache/oracle-jdk11-installer-local
sudo cp jdk-11.0.3_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/
sha256sum mismatch jdk-11.0.3_linux-x64_bin.tar.gz
Oracle JDK 11 is NOT installed.
dpkg: error processing package oracle-java11-installer-local (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java11-installer-local
E: Sub-process /usr/bin/dpkg returned an error code (1)
hey, thanks for the guide. you made a spellerror, the package is called dirmngr. you missed the “n”
🙂
thanks man , it bothered me installing it in other ways I spent like 2 hours testing all tutorials , but this one works , so thanks again
“You have successfully installed Java 11 on Debian 8 Strech Linux system.”
?
Sorry, This article was tested on Debian 9. I have corrected the typo.