Share your love
Easy Steps To Set up OpenJDK 19 on AlmaLinux 8

In this guide, we want to show you how to Set up OpenJDK 19 on AlmaLinux 8. OpenJDK 19 is a production-ready and open-source distribution of Java Development Kit (JDK) version 19, which was released on September 20th, 2022. JDK 19 is a scheduled update as per Oracle’s 6-month release cadence. It doesn’t come with breaking changes – with almost all features in the incubator and preview phases. Now follow the steps below on the Orcacore website to start your OpenJDK 19 setup on AlmaLinux 8.
Table of Contents
Steps To Set up OpenJDK 19 on AlmaLinux 8
To complete this guide for OpenJDK 19 AlmaLinux 8, log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 8.
1. Install OpenJDK 19 AlmaLinux 8
First, you need to update your local package index with the command below:
sudo dnf update -y
Then install the required packages by using the following command:
sudo dnf install curl wget tar -y
Download OpenJDK 19
At this point, you need to visit the JDK Downloads page to download the latest archive by using the wget command:
sudo wget https://download.java.net/java/GA/jdk19.0.1/afdd2e245b014143b62ccb916125e3ce/10/GPL/openjdk-19.0.1_linux-x64_bin.tar.gz
Then, extract your downloaded file with the command below:
sudo tar xvf openjdk-19.0.1_linux-x64_bin.tar.gz
Next, move your extracted file to the /opt directory:
sudo mv jdk-19.0.1 /opt/
Configure Java Environment Path
At this point, you need to configure the Java home path by using the following command:
sudo tee /etc/profile.d/jdk19.sh <<EOF
export JAVA_HOME=/opt/jdk-19.0.1
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
Source your profile file with the following command:
source /etc/profile.d/jdk19.sh
Verify your Java Home path:
echo $JAVA_HOME
Output
/opt/jdk-19.0.1
Also, you can verify your Java 19 installation on AlmaLinux 8 by checking its version:
java -version

2. Install Java SE Development Kit 19 on AlmaLinux 8
If you choose to go with Java SE Development Kit 19, download the RPM package for CentOS / RHEL / Fedora system using the command below:
sudo wget https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.rpm
Then, install the RPM package using the yum or rpm command:
sudo rpm -Uvh jdk-19_linux-x64_bin.rpm
Output
warning: jdk-19_linux-x64_bin.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:jdk-19-2000:19.0.2-7 ################################# [100%]
Confirm the Java installation on AlmaLinux 8:
java -version

Configure the Java environment with the command below:
cat <<EOF | sudo tee /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/java/default
export PATH=\$PATH:\$JAVA_HOME/bin
EOF
To use Java Home, source the file by using the following command:
source /etc/profile.d/jdk.sh
3. Test OpenJDK 19 AlmaLinux 8
At this point, we will show you how to create a sample project to see that your Java 19 is working correctly on AlmaLinux 8.
Create and open the hello world file with your favorite text editor, here we use the vi editor:
vi HelloWorld.java
Add the following content to the file:
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}
When you are done, save and close the file.
Then, compile and run your Java code:
java HelloWorld.java
Output
Hello, World
That’s it, you are done.
Conclusion
At this point, you have learned to Install OpenJDK 19 on AlmaLinux 8. You can easily download the OpenJDK 19 or Java SE Development Kit 19, then, set up the Java home path and complete your setup.
Hope you enjoy it. You may also like these guides:
Install Go Language on AlmaLinux 8
Install and Configure OpenNMS on AlmaLinux 8
Ntopng Setup Guide AlmaLinux 8
Gulpjs Automation Tool on AlmaLinux 8