How to Install Java JDK 17 on Ubuntu 22.04

Install Java 17 on Ubuntu 22.04
Install Java 17 on Ubuntu 22.04

Java 17 LTS is the latest long-term support release for the Java SE platform. This newest release includes JDK 17, which provides an environment for building applications using the Java programing language, testing, and running the Java programs.

Here, we will see how to install Java JDK 17 on Ubuntu 22.04.

Install OpenJDK 17 on Ubuntu 22.04

OpenJDK has separate packages for JDK (Java Development Kit) for developing Java applications and JRE (Java Runtime Environment) for running Java applications.

First, update the repository index.

sudo apt update

Then, install the OpenJDK or JRE package as per the requirement.

OpenJDK 17 JDK

sudo apt install -y openjdk-17-jdk

OpenJDK 17 JRE

sudo apt install -y openjdk-17-jre

Install Oracle JDK 17 On Ubuntu 22.04

First, install dependencies for Oracle JDK 17 installation.

sudo apt update

sudo apt install -y libc6-x32 libc6-i386

Then, download Oracle Java JDK 17 using the wget command in the terminal.


Finally, install Oracle Java JDK 17 using the dpkg command.

sudo dpkg -i jdk-17_linux-x64_bin.deb

In some cases, you may need to install Oracle JDK 17 on the PATH location.

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-17/bin/java 1

Verify Java JDK Installation

After installing JDK, use the below command to verify the version.

java -version


java version "17.0.3" 2022-04-19 LTS
Java(TM) SE Runtime Environment (build 17.0.3+8-LTS-111)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.3+8-LTS-111, mixed mode, sharing)


That’s All. I hope you have learned how to install Java JDK 17 on Ubuntu 22.04.

You might also like