Fork me on GitHub

Install Java 17 Linux -

Install Java 17 on Linux Java 17 is a long-term support (LTS) release of the Java SE platform. Here's how to install it on your Linux system: Prerequisites

Linux distribution (e.g., Ubuntu, Debian, CentOS, Fedora) Internet connection

Method 1: Install Java 17 using apt (Ubuntu/Debian-based systems)

Update the package index : sudo apt update Install the Java 17 package : sudo apt install openjdk-17-jdk Verify the Java installation : java -version install java 17 linux

You should see output similar to: openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment (build 17.0.2+8-ubuntu-2ubuntu1) OpenJDK 64-Bit Server VM (build 17.0.2+8-ubuntu-2ubuntu1, mixed mode, sharing)

Method 2: Install Java 17 using yum (RHEL/CentOS-based systems)

Install the Java 17 package : sudo yum install java-17-openjdk Verify the Java installation : java -version Install Java 17 on Linux Java 17 is

You should see output similar to: openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment (build 17.0.2+8-1.el9) OpenJDK 64-Bit Server VM (build 17.0.2+8-1.el9, mixed mode, sharing)

Method 3: Install Java 17 manually

Download the Java 17 package from the official Oracle website: https://www.oracle.com/java/technologies/javase-jdk17-downloads.html Extract the package : tar -xvf jdk-17_linux-x64_bin.tar.gz Move the extracted package to the desired location : sudo mv jdk-17 /usr/local/ Update the alternatives : sudo update-alternatives --install /usr/bin/java java /usr/local/jdk-17/bin/java 1 Verify the Java installation : java -version You should now have Java 17 installed on your Linux system

Set the JAVA_HOME environment variable To set the JAVA_HOME environment variable, add the following lines to your shell configuration file (e.g., ~/.bashrc ): export JAVA_HOME=/usr/local/jdk-17 export PATH=$JAVA_HOME/bin:$PATH

Restart your terminal or run source ~/.bashrc to apply the changes. That's it! You should now have Java 17 installed on your Linux system.