
In this tutorial, we are going to explain in step-by-step detail how to install Java SE 19 on Ubuntu 22.04 OS.
Java SE platform or Java Standard Edition is a computing platform for the development and deployment of portable Java code on server environments.
It is portable for deployment on desktops and can be installed on different operating systems, such as Windows, MacOS, but in this blog post, we will focus on installing it on Linux server environments.
OpenJDK is a free and open-source implementation of the Java SE Platform Edition. The other type of Java is the Oracle JDK which is more enterprise-oriented.
Installing Java SE on Ubuntu 22.04 is a straightforward process that may take up to 10 minutes. Let’s get started!
Table of Contents
Prerequisites
- A server with Ubuntu 22.04 as OS
- User privileges: root or non-root user with sudo privileges
Step 1. Update the System
Before we start with the installation of Java, it is recommended to update the system packages to their latest versions available.
Step 2. Install Java SE 19 from Default Repository
There are two ways of installing Java SE 19 on Ubuntu 22.04. The first way is to install it from the Ubuntu 22.04 default repository with the following command:
After installation, you can check the installed version with the following command:
The output should look like this:
Step 3. Install Java SE 19 from the Debian package Manually
The second way is to install Java with the Debian package downloaded from the official Java SE development kit website. To download the Java SE 19 development kit faster, execute the following command:
Before we continue with the installation, we need to install some prerequisites:
Once the prerequisites are installed and Java is downloaded, execute the following command:
The installation process will start:
Once the installation process is finished, we need to set the Java variables using the following commands:
Now, open the /etc/environment file with your favorite editor and paste the following line at the bottom:
Next, activate the Java environment variable with the following command:
The last thing is to update the alternatives with the correct Java directory
After this, you can check the installed version with the following command:
The output should look like this:
That’s it. You successfully installed and managed to configure Java SE 19 on Ubuntu 22.04 in two different ways.
Of course, if this setup is difficult for you, please contact our technical support. We are available 24/7 and will help you with any aspect of Java SE 19 installation and configurations. All you need to do is to sign up for one of our managed VPS hosting plans and submit a support ticket.
If you liked this post on how to install Java SE 19 on Ubuntu 22.04, please share it with your friends on social networks or simply leave a reply below. Thanks.
This happens when you do sudo apt install openjdk-19-jdk openjdk-19-jre:
E: Unable to locate package openjdk-19-jdk
E: Unable to locate package openjdk-19-jre
Before start with the installation of java, it is recommended to update the system packages to their latest versions available. Also, you can follow the steps to install Java SE 19 from the Debian package manually.