This tutorial will help you to install Java 17 on Debian 11/10/9 systems using PPA and apt-get command. Ubuntu and Linux Mint users use the below link to install Java on their system.

Read this => Install Java 8 LTS on Debian Read this => Install latest Java on Ubuntu & LinuxMint

Step 1 – Add PPA to System

The webupd8 team has built a Java installer package for Debian systems. You need to add that PPA repository to your system for installing Java 17 on Debian. Create a new Apt configuration file /etc/apt/sources.list.d/java-17-debian.list, and edit in text editor. and add following content in it. Now import GPG key on your system for validating packages before installing them.

Step 2 – Install Latest Java on Debian

You are all set to start Java installation on Debian. Run the following commands to update apt-cache and then install Java 17 on the Debian system using the apt-get package manager. The installer will prompt for accept Oracle terms in order to continue Java installation on Debian. Accept the terms and complete setup.

Step 3 – Verify Java Installation

Finally, you have successfully installed Oracle Java on your Debian system. Let’s use the following command to verify the installed version of Java on your system.

Step 4 – Setup Java Environment

The Webupd8 PPA repository also provides a package to set environment variables, Install this package using the following command. The installer script set the environment variable for you. You can find these variables in /etc/profile.d/ script.

Step 5 – Switching Java Version

The Debian systems have installed multiple Java version’s can switch between them. The update-alternatives command line utility allows switching the Java version. Run the following command to list selection list: This command will list all the installed Java version (Configured with update-alternatives). You will see the list like below: Type a number to select Java version to set as default Java version on your Debian system. References: