We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Java 17 (OpenJDK 17) on Debian 11/10/9

Learn how to – Install Java 17 (OpenJDK 17) on Debian 11/10/9.

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.0.4" 2022-07-19
OpenJDK Runtime Environment (build 17.0.4+8-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 17.0.4+8-Debian-1deb11u1, 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 <<EOF | sudo tee /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/jdk-17/
export PATH=$PATH:$JAVA_HOME/bin
EOF

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.0.4.1" 2022-08-18 LTS
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)

Option 2) Install OpenJDK 17 on Debian 10/9

Visit JDK 17 releases page to download the latest archive.

wget https://download.java.net/openjdk/jdk17/ri/openjdk-17+35_linux-x64_bin.tar.gz

Extract the downloaded OpenJDK 17 archive file using tar command.

tar xvf openjdk-17+35_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 <<EOF
export JAVA_HOME=/opt/jdk17
export PATH=$PATH:$JAVA_HOME/bin
EOF

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.

Recommended books:

For CentOS / Fedora, refer use:

Cart

Your Cart is Empty

Back To Shop