How to Install JDK 25 (Java 25) on Ubuntu 24.04

5 min readUpdated May 19, 2026

This guide describes how to install JDK 25 (Java 25) on a server running Ubuntu 24.04.

#Installing Java on Ubuntu

The openjdk-25-jdk package is available from the Universe repository, so the installation is done with standard tools without adding any third-party PPA.

#Step 1. Enabling the Universe repository

First, enable the Universe repository.

bash
sudo add-apt-repository universe

Note that the system may ask you to press Enter to confirm the operation. Do that.

Enabling the Universe repository on Ubuntu 24.04

#Step 2. Updating the package lists

Next, update the package lists so the system uses current data about available packages.

bash
sudo apt update
Updating the package lists with the apt update command

#Step 3. Installing JDK 25

Now install JDK 25 (Java 25) with the following command.

bash
sudo apt install openjdk-25-jdk -y

The process may take a few minutes depending on your network speed and server performance.

#Step 4. Verifying the installation

After the installation is complete, check the Java version.

bash
java -version

The output should look like the screenshot below. This means that the JDK (Java) has been installed successfully and is ready to use.

Output of the java -version command with JDK 25 installed

#Removing Java

If for some reason you need to remove this Java, use the commands below.

bash
sudo apt remove --autoremove openjdk-25-jdk

The command below additionally removes the package configuration files.

bash
sudo apt purge --autoremove openjdk-25-jdk

Did not find the answer? We are online 24/7.Contact support