How to install java 17 on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install java 17 on Ubuntu 22.04.

Java runtime environment can be easily installed on any Ubuntu version, by simply downloading the official package openjdk-17-jre , which can be found on the Universe repository for Ubuntu 22.04.

Java runtime environment can also be installed on other Ubuntu versions, by simply installing openjdk-17-jre, as this package is also available on the main repositories for other Ubuntu versions such as :Ubuntu 20.04, Ubuntu 23.04 and Ubuntu 23.10.

You need Java runtime environment installed on your machine, in order to run java based softwares.

Step 1 - Update your system

Before installing Java 17 on your machine, run the command below to update your machine. Updating is necessary before installing openjdk-17-jre so that your package index file has the repository from where you can download java 17.

sudo apt update

Step 2 - Install Java 17

Once you have updated your machine, proceed to install Java Runtime Environment.

Java Runtime Environment can be easily installed from the terminal.

To install Java Runtime Environment, simply run the command below.

sudo apt install openjdk-17-jre

Step 3 - Verify Java installation

Java runtime environment 17 should be now installed on your Ubuntu 22.04 machine. To verify that the installation process went fine, and that you are able to use Java runtime environment, you can check its version by running the command below.

java --version


In this tutorial, you learned how to install Java runtime environment 17 on Ubuntu 22.04.

Even though we used Ubuntu 22.04 in this tutorial, you should be able to install Java runtime environment on all Ubuntu versions we mentioned above by simply installing the official package of Java runtime environment openjdk-17-jre.