In this guide,we will look at how you can install Java 11 on Oracle Linux 8. Java is a widely adopted programming Language in businesses and personal projects alike. The latest version of Java available on Oracle Linux 8 repository is Java 11. In this post, we will install OpenJDK 11 on Oracle Linux 8.
OpenJDK is an open-source implementation of the Java Platform, Standard Edition licensed under the GNU General Public License version 2. The Oracle Linux 8 AppStream repository contains the OpenJDK binaries from a fully open source set of build scripts and infrastructure.
Install Java 11 (OpenJDK 11) on Oracle Linux 8
Update your Oracle Linux machine to ensure you’re working with the latest releases of packages.
sudo dnf update
If you’re okay with the updates to be pushed to the system, accept with the y key.
....
Transaction Summary
=======================================================================================================================================================
Upgrade 11 Packages
Total download size: 25 M
Is this ok [y/N]: y
You can consider rebooting the system if there were kernel updates.
sudo systemctl reboot
You can get a list of Java 11 related packages on Oracle Linux 11 using the command below.
sudo yum search java-11-openjdk
We will install java-11-openjdk package.
sudo dnf install java-11-openjdk
Dependency tree will be resolved automatically for you.
....
Transaction Summary
==========================================================================================================================================================================================================
Install 169 Packages
Total download size: 117 M
Installed size: 442 M
Is this ok [y/N]: y
Confirm Java 11 (OpenJDK 11) on Oracle Linux 8
Validate that Java was installed successfully on your Oracle Linux 8 machine.
$ java -version
openjdk version "11.0.25" 2024-10-15 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.25.0.9-1) (build 11.0.25+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.25.0.9-1) (build 11.0.25+9-LTS, mixed mode, sharing)
Write a test HelloWorld java application.
cat > Hello_World.java <<EOF
public class helloworld {
public static void main(String[] args) {
System.out.println("Hello Java World from Kenya!");
}
}
EOF
Execute the application.
$ java Hello_World.java
Hello Java World from Kenya!
Yey!.. Seems Java 11 has been installed successfully on our Oracle Linux 8 system. Our next guide will cover installation of Java 8 on Oracle Linux 8.