Install Java 17 (OpenJDK 17) on Debian 11/10/9

Posted on 83 views

Welcome to our guide on how to install Oracle Java 17 / OpenJDK 17 on 11/10/9 Linux system. Java is a popular programming language used for developing Web, Mobile and Desktop Applications. The Java Platform lets you develop and deploy Java applications on servers, desktops and IoT devices

JDK 17 is the open-source reference implementation of version 17 of the Java SE Platform as specified by by JSR 388 in the Java Community Process. You can read the release notes on JDK 17 to get a view of new and interesting features.

So let’s see how you can install Java 17 (OpenJDK 17) on Debian 11/10/9 Linux system. If you choose to go with Java SE Development Kit 17, download DEB package for Debian Linux.

Install Java 17 (OpenJDK 17) on Debian 11

Java 17 packages are available on Debian 11 repositories as seen below:

$ sudo apt update
$ apt-cache search openjdk | grep 17
openjdk-17-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-17-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-17-doc - OpenJDK Development Kit (JDK) documentation
openjdk-17-jdk - OpenJDK Development Kit (JDK)
openjdk-17-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-17-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-17-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-17-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-17-source - OpenJDK Development Kit (JDK) source files

This means the packages can be installed from the OS APT repositories:

# Install openJDK JDK 17
sudo apt install openjdk-17-jdk

# Install OpenJDK JRE
sudo apt install openjdk-17-jre

Check Java version after installation:

$ java -version
openjdk version "17-ea" 2021-09-14
OpenJDK Runtime Environment (build 17-ea+19-Debian-1)
OpenJDK 64-Bit Server VM (build 17-ea+19-Debian-1, mixed mode, sharing)

Install Java 17 (OpenJDK 17) on Debian 10/9

Update your list of packages and install wget.

sudo apt update
sudo apt -y install wget curl

The download the Java SE Development Kit 17 package.

wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.deb

Then install the DEB package using the apt command:

sudo apt install ./jdk-17_linux-x64_bin.deb

Agree to installation when prompted.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'jdk-17' instead of './jdk-17_linux-x64_bin.deb'
The following additional packages will be installed:
  alsa-topology-conf alsa-ucm-conf libasound2 libasound2-data libc6-i386 libc6-x32 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxrender1 libxtst6 x11-common
Suggested packages:
  libasound2-plugins alsa-utils
The following NEW packages will be installed:
  alsa-topology-conf alsa-ucm-conf jdk-17 libasound2 libasound2-data libc6-i386 libc6-x32 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxi6 libxrender1 libxtst6 x11-common
0 upgraded, 17 newly installed, 0 to remove and 3 not upgraded.
Need to get 7434 kB/163 MB of archives.
After this operation, 346 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Configure Java environment.

cat <

To check if you have Java installed on your machine, type the following command:

$ source /etc/profile.d/jdk.sh
$ java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

2) Install OpenJDK 17 on Debian 10/9

Visit JDK 17 releases page to download the latest archive.

wget https://download.java.net/java/GA/jdk17.0.1/2a2082e5a09d4267845be086888add4f/12/GPL/openjdk-17.0.1_linux-x64_bin.tar.gz

Extract the downloaded OpenJDK 17 archive file using tar command.

tar xvf openjdk-17.0.1_linux-x64_bin.tar.gz

Move the resulting folder to /opt directory.

sudo mv jdk-17*/ /opt/jdk17

Configure Java environment:

sudo tee /etc/profile.d/jdk.sh <

Source your profile file and check java command

source /etc/profile.d/jdk.sh

Confirm Java version.

$ echo $JAVA_HOME
/opt/jdk-17

$ java -version
openjdk 17 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

Kudos!. You’ve successfully install Oracle Java 17 on Debian 11/10/9 Linux machines.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.