×



JDK 17 is finally out and was released on 14, September 2021 with lots of new features on the table. It is the latest LTS version of OpenJDK by the time of publishing this tutorial.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Java queries on Linux system.

In this context, we shall look into how to install OpenJDK 17 on Debian 11 system.


Different ways of installing Java 17 LTS (JDK 17 ) On Debian 11

1. Install Java from OpenJDK using the APT package manager

OpenJDK ( Open Java Development Kit ) is an opensource and free implementation of Java SE ( Standard Edition ). It provides a number of components including the Java Runtime Environment ( JRE ), Java compiler, Java Class Library, and the Java Virtual Machine.

To install OpenJDK 17, follow the steps outlined below.

i. Perform system update 

Start by updating all the system packages lists with the below commands:

$ sudo apt update
$ sudo apt upgrade


ii. Install OPenJDK 17 on the system

Once all packages are in the latest versions, proceed and install OpenJDK 17 with the below command:

$ sudo apt install openjdk-17-jre openjdk-17-jdk

This installs all the OPenJDK packages, libraries and dependencies. Once completed, go ahead and confirm that OpenJDK 17 is installed:

$ sudo apt-cache policy openjdk-17-jre openjdk-17-jdk

Additionally, confirm that Java is installed with the below command:

$ java --version


2. Manually install Java 17 from a Tarball file

Another way way of installing OpenJDK 17 is by manually installing it from a Tarball file. This method gives you more freedom and flexibility to determine where it is installed.

To manually install OpenJDK 17, follow the steps below.

i. Install dependencies

First off, install a few dependencies that will be needed during the manual installation with the below command;

$ sudo apt install libc-i386 libc6-x32 curl -y

ii. Download OpenJDK 11 tarball file

Next, visit the Oracle Downloads page and grab the OpenJDK 17 tarball file:

$ curl -O https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

When the download is complete, Extract the compressed file:

$ tar -xvf jdk-17_linux-x64_bin.tar.gz

iii. Configure and install Java 17

To install Java 17, move the JDK folder to the /opt/ path and give it an easy and convenient name. Here, we have renamed it jdk17:

$ sudo mv jdk-17.0.1 /opt/jdk17

Finally, define the environment variables using the export command:

$ export JAVA_HOME=/opt/jdk-17
$ export PATH=$PATH:$JAVA_HOME/bin

Double-check the version of Java installed using the command:

$ java --version


[Need to configure Java on your Linux system ? We can help you. ]


Conclusion

This article covers how to install the latest OpenJDK, and by extension Java 17 on your Debian 11 Bullseye system. In fact, JDK 17 (JDK 17) has brought forward new language enhancements, updates to the libraries, support for new Apple computers, removals and deprecations of legacy features, and work to ensure Java code written today will continue working without change in future JDK versions.


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com