How to Install OpenJDK JDK 25 LTS in Ubuntu 24.04 | 22.04

Last updated: January 12, 2026 — 3 Comments

OpenJDK announced the latest JDK 25 on September 16, 2025. This is the beginner’s guide shows how to install it in all current Ubuntu and Linux Mint releases.

OpenJDK 25 is the Long Term Support release with 5-years support until 2030. Ubuntu has made JDK 25 into system repository for current releases, while user may also choose the official tarball for choice.

image from oracle.com

Difference between OpenJDK and Oracle JDK

OpenJDK and Oracle JDK are “same thing”, but with different licence.

Oracle JDK is built from the OpenJDK JDK source, but non-opensource licence. While both OpenJDK source and the OpenJDK builds binaries are distributed under the same GPL2+CPE licence.

Both are free! Though, Oracle also offers a subscription for the Oracle JDK builds that user can buy for support! And, I’ve written about how to install Oracle Java 21/25 in Ubuntu.

Option 1: Install Open JDK 25 from System Repository

Ubuntu supports the long term support (LTS) OpenJDK releases. Like JDK 8, JDK 17, and JDK 21, the new OpenJDK 25 has been made into system repositories for Ubuntu 22.04, Ubuntu 24.04, Ubuntu 25.04/25.10, and next Ubuntu 26.04.

To install it, press Ctrl+Alt+T on keyboard to open terminal and run command:

sudo apt install openjdk-25-jdk

Run sudo apt update to refresh cache if failed. And you may replace openjdk-25-jdk with openjdk-25-jre for just run-time environment.

If you have multiple versions of Java installed, and JDK 25 is not set as default after installation, then you may run the command below and choose one to be default:

sudo update-alternatives --config java

Also replace java with javac or jar to set the defaults for other executables.

Option 2: Install OpenJDK JDK 25 from official tarball

NOTE: The steps below will override Oracle JDK 25 if installed.

1. To install the new OpenJDK JDK 25, first go to java website via the link below:

Then select download the “Linux / x64” build for AMD/Intel platform, or “Linux / AArch64” for ARM devices (e.g., Raspberry Pi).

2. After downloaded the Linux tarball, press Ctrl+Alt+T to open up a terminal window, and run commands below to extract to /usr/lib/jvm directory.

  • First, create the target directory in case this is the first time you install Java on the system.
    sudo mkdir -p /usr/lib/jvm
  • Then, run command to extract OpenJDK 24 tarball into that directory:
    sudo tar -zxf ~/Downloads/openjdk-25*_bin.tar.gz -C /usr/lib/jvm/

    Here assume you saved the tarball in user Downloads folder.

After that, run ls /usr/lib/jvm/ to list directory content. It should include a new jdk-25 (or jdk-25.0.1, jdk-25.0.2, etc) sub-folder.

3. Set OpenJDK JDK 25 as default.

To set it as default, first run commands below one by one to link executable files as alternatives:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-25/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-25/bin/javac 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-25/bin/jar 1

As you see in the screenshot below, there are many other executable files under /usr/lib/jvm/jdk-25/bin (e.g., javap, jdb, jfr, and more). You may run similar commands above for them one by one as you need.

NOTE: As time goes on, OpenJDK may release updates for JDK 25. In the case, you’ll need to replace “jdk-25” in command with “jdk-25.0.1” or “jdk-25.0.2” according to the Java root folder name under “/usr/lib/jvm”.

After that, run the commands below one by one to choose default Java:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config jar

Also run similar command above for other executable files if you created links for them.

4. Finally, run command to check the default Java edition:

java --version
javac --version

And, use java -XshowSettings:properties -version to print more the properties.

Uninstall OpenJDK JDK 25

If you installed OpenJDK 25 from Ubuntu system repository, simply run the command below in terminal (Ctrl+Alt+T) to uninstall:

sudo apt remove --autoremove openjdk-25-jdk* openjdk-25-jre*

To uninstall OpenJDK JDK 25 installed via the Linux tarball, run command to remove the Java folder under /usr/lib/jvm:

sudo rm -R /usr/lib/jvm/jdk-25*

Then, remove the alternative links:

sudo update-alternatives --remove java /usr/lib/jvm/jdk-25/bin/java
sudo update-alternatives --remove javac /usr/lib/jvm/jdk-25/bin/javac
sudo update-alternatives --remove jar /usr/lib/jvm/jdk-25/bin/jar

Also run similar command above for other executable files if added. And, replace jdk-25 with jdk-25.0.1 etc. for point releases.

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

3 responses to How to Install OpenJDK JDK 25 LTS in Ubuntu 24.04 | 22.04

  1. Excellent instructions.
    Thank you very much!

  2. Many thanks
    These instructions were great

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*