Welcome to our guide on how to install Oracle Java 17 / OpenJDK 17 on 12/11/10 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 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
Java 17 packages are available on Debian 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
uwsgi-plugin-jvm-openjdk-17 - Java plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-jwsgi-openjdk-17 - JWSGI plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-ring-openjdk-17 - Closure/Ring plugin for uWSGI (OpenJDK 17)
uwsgi-plugin-servlet-openjdk-17 - JWSGI plugin for uWSGI (OpenJDK 17)
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.10" 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.10+7-Debian-1deb12u1, 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.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, 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/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
Extract the downloaded OpenJDK 17 archive file using tar command.
tar xvf openjdk-17.0.2_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.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
Kudos!. You’ve successfully install Oracle Java 17 on Debian 12/11/10/9 Linux machines.
Recommended books:
For CentOS / Fedora, refer use:
Note: The first method installs early access build which is not the one you would generally use.
This doesn’t work for me. The files are there but java -version says it’s v16, and update-alternatives –config java doesn’t list any options for jdk 17
Debian 10
I guess you have multiple versions of Java. Set 17 as default. Alternatively uninstall any other version before you install Java 17.
After using the first and the seccond method, Im still having :
X@X:/X/X# sudo tee /etc/profile.d/jdk.sh < export JAVA_HOME=/opt/jdk17
> export PATH=\$PATH:\$JAVA_HOME/bin
> EOF
export JAVA_HOME=/opt/jdk17
export PATH=$PATH:$JAVA_HOME/bin
X@X:/X/X# source /etc/pro
profile profile.d/ protocols
X@X:/X/X# source /etc/pro
profile profile.d/ protocols
X@X:/X/X# source /etc/profile.d/jdk.sh
X@X:/X/X# echo $JAVA_HOME
/opt/jdk17
X@X:/X/X# java -version
openjdk version “1.8.0_292”
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
nice, It has run perfectly