One notable aspect of Java’s release cycle is the distinction between Long-Term Support (LTS) versions and non-LTS versions. LTS versions, as the name suggests, receive long-term support from Oracle, with updates and security patches provided for an extended period, making them ideal for enterprise environments that prioritize stability and security. In contrast, non-LTS versions have a shorter support window, typically receiving updates for six months until the next non-LTS release is available. These versions serve as a testing ground for new features and enhancements, allowing developers to experiment with cutting-edge features before they are incorporated into LTS releases.
Java 20 is a non-LTS version that introduces numerous enhancements and features, showcasing the future direction of the language and its ecosystem. While non-LTS versions may not be suitable for mission-critical systems, they are invaluable for developers looking to stay at the forefront of Java technology and explore the latest advancements.
This tutorial will guide you through the process of installing Java 20 on Fedora and CentOS Steam 9/8 and RHEL 9/8, enabling you to harness the full potential of this powerful programming language in your projects.
- A system running Fedora, CentOS 9/8, or RHEL 9/8.
- A user account with sudo privileges.
Step 1: Update Your System
Before installing Java 20, ensure that your system is up-to-date. To do this, run the following commands:
sudo dnf update -y
Step 2: Download Java 20
Navigate to the official Oracle JDK website (https://www.oracle.com/java/technologies/downloads/#java20) to download the latest JDK 20 release. Select the appropriate version for your system (Linux x64 Compressed Archive). Alternatively, you can use the command-line tool ‘wget’ to download the file directly:
Step 3: Installing Java 20
After downloading the Java package file, use the
`rpm` command to install it on your system. The non-root user must use
`sudo` run command with special privileges that allow the installation.
Execute the following command to install Java 20:
sudo rpm -Uvh jdk-20_linux-x64_bin.rpm
Once the installation is completed, this version will be the default Java version. But in case the system is still using the older version, use alternatives command to change the default Java version. The alternatives binary is provided by chkconfig package.
sudo alternatives --config java
OutputThere are 2 programs which provide 'java'. Selection Command ----------------------------------------------- + 1 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-18.104.22.168.9-2.fc35.x86_64/bin/java) * 2 /usr/java/jdk-20.0.1/bin/java Enter to keep the current selection[+], or type selection number: 2
According to the above screenshot, there are 2 versions installed. Java 20 is listed on number 2, So input numeric 2 and press Enter. This will change the default Java version to 20 on your system.
Step 3 – Check Default Java Version
Check the installed Java version on your system using the following command.
Outputjava version "20.0.1" Java(TM) SE Runtime Environment (build 20.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 20.0.1+11, mixed mode, sharing)
Step 4 – Setup Java Environment Variables
Most Java-based applications use environment variables to work. Set the Java environment variables using the following commands
- Setup JAVA_HOME Variable
Also, put all the above environment variables in /etc/environment file for auto-loading on system boot.
You have successfully installed Java 20 on Fedora and CentOS Steam 9/8 and RHEL 9/8. With the latest JDK installed, you can now develop and run Java applications on your system. Remember to keep your JDK updated to ensure compatibility with new features and security patches. If you wish to explore additional tools and resources for Java development, consider checking out popular Integrated Development Environments (IDEs) such as IntelliJ IDEA, Eclipse, and NetBeans. These IDEs provide a wide range of features and tools to streamline your development process and enhance productivity.