Ubuntu 24.04: A Comprehensive Guide to Installing OpenJDK JRE and JDK

In this article, we cover how to install OpenJDK JRE and OpenJDK JDK in Ubuntu 24.04 release. But, before that, it is essential to highlight the differences between the two. JRE or Java Runtime Environment is to be used when a user just wants to run Java applications. It provides the necessary runtime environment that helps run Java applications.

On the other hand, JDK or Java Development Kit in addition to everything that comes with installing JRE also has the necessary tools that are required for the development of a Java application.

To summarize, if you are only running Java applications go for JRE. And, if you intend to build Java applications go with JDK.

At the time of writing, v21 is its latest stable release. We can check stable release updates on JDK updates.

https://openjdk.org/projects/jdk/

We have covered the installation of both in subsequent sections.

Note: The following operations require Administrative rights. If you lack the necessary rights to make changes to your system then, contact your System Administrator for assistance.

Update standard Ubuntu repository

Both the packages are part of the standard Ubuntu repository. Therefore, we need to update the repository first to get the latest version of both packages. So, open a terminal and issue the following in the terminal:

sudo apt update

Install OpenJDK JRE in Ubuntu 24.04

To install OpenJDK JRE:

sudo apt install openjdk-21-jre

Install OpenJDK JDK in Ubuntu 24.04

To install OpenJDK JDK:

sudo apt install openjdk-21-jdk

Since v21 was the latest stable release. It was available through the standard Ubuntu repository. Therefore, we went ahead with that release. If it’s different for you then, try changing the version number.

We can list all the available OpenJDK releases through the following command:

apt-cache search "openjdk" | grep jre

or,

apt-cache search "openjdk" | grep jdk

Once, you have identified the version you wish to install use APT (Advanced Packaging Tool) to install it.

In conclusion, we have covered here how to install OpenJDK JRE/JDK in Ubuntu 24.04.

Similar Posts