October 21, 2021
How to install java 11 on Debian 11

How To Install Java (OpenJDK) 11 on Debian 11

On this article we will learn how to install OpenJDK 11 on Debian 11 (Bullseye) operating system which was released on 14 August 2021.

Introduction

Java is known as the most popular programming languages used to build many applications and systems. Java runs on all major operating systems and devices. In this tutorial, we will learn how to install Java 11 (OpenJDK 11) on Debian 11 operating system. With Java installed on the system, we can install other applications that have any dependencies on Java applications.

OpenJDK 11 Installation on Debian 11

On this section we will show you how to install OpenJKD 11 on Debian 11 operating system. The installation starts by checking whether the system already has java installed or not, for this purpose we will submit the command line : java -version.

ramansah@otodiginet:~$ java -version
bash: java: command not found

By this information, we know if there is no Java installed yet on the system.

Prerequisite

Before we are going to install OpenJDK 11 on Debian 11, there are several prerequisite to be fulfilled, namely :

  • we have a root account or ordinary account with sudo privilege
  • sufficient disk space, good internet connection

Java (OpenJDK) 11 Installation

1. Updating Debian 11 System

By updating our system, it will refresh the local list of available packages software to the newer stable version. To update Debian 11 system repositories, we will use the command line: sudo apt update.

ramansah@otodiginet:~$ sudo apt update
Hit:1 http://ftp.debian.org/debian stretch-backports InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease        
Get:3 http://deb.debian.org/debian bullseye InRelease [113 kB]                      
Hit:4 http://deb.debian.org/debian-security bullseye-security InRelease
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease
Get:6 http://deb.debian.org/debian bullseye-proposed-updates InRelease [44.4 kB]
Get:7 http://deb.debian.org/debian bullseye/main Sources [8,612 kB]
Get:8 http://deb.debian.org/debian bullseye/main amd64 Packages [8,178 kB]                               
Get:9 http://deb.debian.org/debian bullseye/main Translation-en [6,241 kB]                               
Get:10 http://deb.debian.org/debian bullseye/main amd64 DEP-11 Metadata [4,049 kB]                       
Get:11 http://deb.debian.org/debian bullseye/main DEP-11 48x48 Icons [3,478 kB]                          
Get:12 http://deb.debian.org/debian bullseye/main DEP-11 64x64 Icons [7,315 kB]                          
Fetched 37.9 MB in 37s (1,022 kB/s)                                                                      
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
9 packages can be upgraded. Run 'apt list --upgradable' to see them.

Then we will upgrade the repositories by typing command line : sudo apt list --upgradable and sudo apt upgrade.

ramansah@otodiginet:~$ sudo apt list --upgradable
Listing... Done
krb5-locales/proposed-updates 1.18.3-6+deb11u1 all [upgradable from: 1.18.3-6]
libapr1/proposed-updates 1.7.0-6+deb11u1 amd64 [upgradable from: 1.7.0-6]
libbluray2/proposed-updates 1:1.2.1-4+deb11u1 amd64 [upgradable from: 1:1.2.1-4]
libgssapi-krb5-2/proposed-updates 1.18.3-6+deb11u1 amd64 [upgradable from: 1.18.3-6]
libk5crypto3/proposed-updates 1.18.3-6+deb11u1 amd64 [upgradable from: 1.18.3-6]
libkrb5-3/proposed-updates 1.18.3-6+deb11u1 amd64 [upgradable from: 1.18.3-6]
libkrb5support0/proposed-updates 1.18.3-6+deb11u1 amd64 [upgradable from: 1.18.3-6]
python3-reportbug/proposed-updates 7.10.3+deb11u1 all [upgradable from: 7.10.3]
reportbug/proposed-updates 7.10.3+deb11u1 all [upgradable from: 7.10.3]
ramansah@otodiginet:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  krb5-locales libapr1 libbluray2 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0
  python3-reportbug reportbug
9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,324 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Reading changelogs... Done
(Reading database ... 135275 files and directories currently installed.)
Preparing to unpack .../libk5crypto3_1.18.3-6+deb11u1_amd64.deb ...
Unpacking libk5crypto3:amd64 (1.18.3-6+deb11u1) over (1.18.3-6) ...
Setting up libk5crypto3:amd64 (1.18.3-6+deb11u1) ...
(Reading database ... 135275 files and directories currently installed.)
Preparing to unpack .../libkrb5support0_1.18.3-6+deb11u1_amd64.deb ...
Unpacking libkrb5support0:amd64 (1.18.3-6+deb11u1) over (1.18.3-6) ...
Setting up libkrb5support0:amd64 (1.18.3-6+deb11u1) ...
(Reading database ... 135275 files and directories currently installed.)
Preparing to unpack .../libkrb5-3_1.18.3-6+deb11u1_amd64.deb ...
Unpacking libkrb5-3:amd64 (1.18.3-6+deb11u1) over (1.18.3-6) ...
Setting up libkrb5-3:amd64 (1.18.3-6+deb11u1) ...
(Reading database ... 135275 files and directories currently installed.)
Preparing to unpack .../libgssapi-krb5-2_1.18.3-6+deb11u1_amd64.deb ...
Unpacking libgssapi-krb5-2:amd64 (1.18.3-6+deb11u1) over (1.18.3-6) ...
Setting up libgssapi-krb5-2:amd64 (1.18.3-6+deb11u1) ...
(Reading database ... 135275 files and directories currently installed.)
Preparing to unpack .../krb5-locales_1.18.3-6+deb11u1_all.deb ...
Unpacking krb5-locales (1.18.3-6+deb11u1) over (1.18.3-6) ...
Preparing to unpack .../reportbug_7.10.3+deb11u1_all.deb ...
Unpacking reportbug (7.10.3+deb11u1) over (7.10.3) ...
Preparing to unpack .../python3-reportbug_7.10.3+deb11u1_all.deb ...
Unpacking python3-reportbug (7.10.3+deb11u1) over (7.10.3) ...
Preparing to unpack .../libapr1_1.7.0-6+deb11u1_amd64.deb ...
Unpacking libapr1:amd64 (1.7.0-6+deb11u1) over (1.7.0-6) ...
Preparing to unpack .../libbluray2_1%3a1.2.1-4+deb11u1_amd64.deb ...
Unpacking libbluray2:amd64 (1:1.2.1-4+deb11u1) over (1:1.2.1-4) ...
Setting up libapr1:amd64 (1.7.0-6+deb11u1) ...
Setting up krb5-locales (1.18.3-6+deb11u1) ...
Setting up python3-reportbug (7.10.3+deb11u1) ...
Setting up libbluray2:amd64 (1:1.2.1-4+deb11u1) ...
Setting up reportbug (7.10.3+deb11u1) ...
Processing triggers for libc-bin (2.31-13) ...
Processing triggers for man-db (2.9.4-2) ...

2. Install OpenJDK 11 On Debian 11

Now, just type the command line : sudo apt-get install openjdk-11-jdk to install OpenJDK 11 on the system.

ramansah@otodiginet:~$ sudo apt-get install openjdk-11-jdk
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java java-common libatk-wrapper-java libatk-wrapper-java-jni libice-dev
  libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev
  openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-dev xorg-sgml-doctools
  xtrans-dev
Suggested packages:
  default-jre libice-doc libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-11-demo openjdk-11-source
  visualvm fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
The following NEW packages will be installed:
  ca-certificates-java java-common libatk-wrapper-java libatk-wrapper-java-jni libice-dev
  libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev
  openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-dev
  xorg-sgml-doctools xtrans-dev
0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 264 MB of archives.
After this operation, 414 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

...

Processing triggers for sgml-base (1.30) ...
Setting up x11proto-dev (2020.1-1) ...
Setting up libxau-dev:amd64 (1:1.0.9-1) ...
Setting up libice-dev:amd64 (2:1.0.10-1) ...
Setting up libsm-dev:amd64 (2:1.2.3-1) ...
Setting up libxdmcp-dev:amd64 (1:1.1.2-3) ...
Setting up libxcb1-dev:amd64 (1.14-3) ...
Setting up libx11-dev:amd64 (2:1.7.2-1) ...
Setting up libxt-dev:amd64 (1:1.2.0-1) ...
OpenJDK 11 installation on Debian 11
OpenJDK 11 installation on Debian 11

The Java 11 installation has been completedly done.

3. Verify Java Version

The last step in Java installation is to verify the java version that we have installed. We just type the command line : java -version, as shown below.

ramansah@otodiginet:~$ java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)
OpenJDK 11 on Debian 11
OpenJDK 11 on Debian 11

Conclusion

We have shown you, how to install Java 11 (OpenJDK 11) on Debian 11 operating system. I hope this article will be useful for who need a Java installation guidance.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *