Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Java 17 on RHEL-based Linux Distributions - DesignLinux

designlinux 0 Comments

Java is a secure, stable, and well-known, general-purpose programming language and computing technology platform with many interconnected capabilities.

To run Java-based applications, you must have Java installed on your server. You mostly need the Java Runtime Environment (JRE), a collection of software components used to run Java applications on the Linux machine.

If you want to develop software applications for Java, you need to install the Oracle Java Development Kit (JDK), which comes with a complete JRE package with tools for developing, debugging, and monitoring Java applications and it is an Oracle’s supported Java SE (Standard Edition) version.

Note: If you are looking for an open-source and free JDK version, install the OpenJDK which provides the same features and performance as Oracle JDK under the GPL license.

In this article, we will show you how to install OpenJDK 16 from the EPEL repository and Oracle OpenJDK 17 (the latest release) using binary packages in RHEL-based Linux distributions such as CentOS, Fedora, Rocky Linux, and AlmaLinux to develop and run Java applications.

Install OpenJDK 16 in CentOS/RHEL and Fedora

At the time of writing this article, OpenJDK 16 is the currently available version to be installed using the following commands from the EPEL repository.

# yum install java-latest-openjdk
# java -version
Sample Output
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment 21.3 (build 16.0.1+9)
OpenJDK 64-Bit Server VM 21.3 (build 16.0.1+9, mixed mode, sharing)

Install Oracle OpenJDK 17 in CentOS/RHEL and Fedora

To install Oracle OpenJDK 17, you need to download the production-ready OpenJDK 17 from the Java SE Downloads page or run the following wget command to download and install it as shown.

# wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm

Install the package using the following command:

# yum localinstall jdk-17_linux-x64_bin.rpm

Next, confirm the installed Java version.

# java -version
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

Set Default Java Version

If you have more than one Java version installed on the system, you need to set the default version using the alternatives command as shown.

# alternatives --config java
Sample Output
There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/java/jdk-17.0.1/bin/java
   2           java-latest-openjdk.x86_64 (/usr/lib/jvm/java-16-openjdk-16.0.1.0.9-3.rolling.el8.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 2

Just, enter the number to set the default Java version on the system.

Finally, check the Java version.

# java -version
Sample Output
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment 21.3 (build 16.0.1+9)
OpenJDK 64-Bit Server VM 21.3 (build 16.0.1+9, mixed mode, sharing)

Congratulations! You’ve successfully installed the latest version of Oracle OpenJDK in RHEL, CentOS, Fedora, and Rocky Linux/AlmaLinux to develop and run Java applications.

Related

Tags: CentOS Tips, Fedora Tips, RHEL Tips

How to Install and Configure Zabbix Agents on Remote Linux – Part 3

Prev Post

Terminator – A Terminal Emulator to Manage Multiple Terminal Windows on Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 257
  • 614,629

DesignLinux.com © All rights reserved

Go to mobile version