How to install Java on Ubuntu 22.04

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Java on Ubuntu 22.04.

As we all know, Java is a very popular programming language and software platform. Thus, Java is indispensable for many Linux developers and professionals who need it to either develop applications or run other applications already created.

Java is available for installation on Linux without too many problems. In this case, we will opt for the OpenJDK version, which is community maintained and fully compatible with the Oracle version.

So let’s go for it.

Install Java on Ubuntu 22.04

Fortunately, we have several versions of Java in the official repositories of Ubuntu 22.04. These different versions can coexist on the system without many issues. However, we usually install one of them.

The versions of Java that can be found in the Ubuntu 22.04 repositories are 8, 11 and 17.

Versions 8 and 11 are LTS, meaning that they are supported for quite a while longer. These are the recommended versions to use. While 17 is the latest stable version.

For this example, we will install version 11 which is one of the most stable versions and combines robustness with newness. Ideal for many applications and serve as a base for others.

To install Java on Ubuntu 22.04 just run the following command

sudo apt update
sudo apt install openjdk-11-jdk

But if you only want the JRE, i.e., you are not going to develop but only run Java applications, it may be convenient not to install everything.

If this is your case, you can install only the JRE by running

sudo apt install openjdk-11-jre
1.- Install Java on Ubuntu 22.04
1.- Install Java on Ubuntu 22.04

This will start the whole installation, which shouldn’t take too long.

Then, you can verify the changes by displaying the Java version.

java --version
openjdk 11.0.14.1 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1, mixed mode, sharing)

That’s how easy it is to get Java on your system.

If you want to learn how to set the JAVA_HOME variable on your system, you can take a look at our post.

How to Set JAVA HOME Path in Ubuntu 20.04

This post can help you a lot.

Conclusion

Thanks to this post, you learned how to install Java quickly and easily. I hope you liked this post and help us to keep growing.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook