Skip to main content

Linux

Checking Your Java Version

To check if Java is already installed and which version you have, run the following command:

java -version

If Java 17 or higher is installed, you'll see output similar to:

openjdk version "17.0.x" 20xx-xx-xx
OpenJDK Runtime Environment (build 17.0.x+x)
OpenJDK 64-Bit Server VM (build 17.0.x+x, mixed mode)

If you don't have Java installed or have a version lower than 17, follow the instructions below for your operating system.

info

If you already have a Java version newer than 17, there is no need to downgrade. The application works with any Java 17 or later release.

Ubuntu 22

Update package index.

sudo apt update

Install OpenJDK 17.

sudo apt install openjdk-17-jre-headless -y

Verify installation.

java -version

Ubuntu 24

Update package index.

sudo apt update

Install OpenJDK 17.

sudo apt install openjdk-17-jre-headless -y

Verify installation.

java -version

CentOS/RHEL 9

Install OpenJDK 17.

sudo dnf install -y java-17-openjdk-headless

Verify installation.

java -version

CentOS/RHEL 10

info

Java 17 is not available in the default RHEL/CentOS 10 repositories. Only Java 21 is provided in AppStream. Since the application supports Java 21, install that instead.

Install OpenJDK 21.

sudo dnf install -y java-21-openjdk-headless

Verify installation.

java -version

Debian 12

Update package index.

sudo apt update

Install OpenJDK 17.

sudo apt install openjdk-17-jre-headless -y

Verify installation.

java -version

Debian 13

info

Java 17 is not available in the default Debian 13 repositories. However, Java 21 is available and can be installed as an alternative.

Update package index.

sudo apt update

Install OpenJDK 21.

sudo apt install openjdk-21-jre-headless -y

Verify installation.

java -version

Manual Installation

Use this method if your distribution does not provide OpenJDK 17 in its package repositories.

Download the OpenJDK 17 tarball from Eclipse Temurin. Select Linux, your architecture (x64 or aarch64), and the .tar.gz package type.

Extract the archive to /opt.

sudo tar -xzf OpenJDK17U-jdk_x64_linux_hotspot_*.tar.gz -C /opt

The extracted directory will be named something like jdk-17.0.x+x. Set JAVA_HOME and add Java to PATH by adding the following lines to /etc/environment.

JAVA_HOME="/opt/jdk-17.0.x+x"
PATH="/opt/jdk-17.0.x+x/bin:$PATH"

Replace jdk-17.0.x+x with the actual directory name from the extraction step.

Reload environment variables.

source /etc/environment

Optionally, register Java with update-alternatives so it is picked up as the system default.

sudo update-alternatives --install /usr/bin/java java $JAVA_HOME/bin/java 1000
sudo update-alternatives --config java

Verify installation.

java -version

Setting JAVA_HOME

After installing Java 17 on Linux, it's recommended to set the JAVA_HOME environment variable:

Find the Java installation path

sudo update-alternatives --config java

Add JAVA_HOME to /etc/environment (adjust the path based on your installation)

echo 'JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"' | sudo tee -a /etc/environment

Reload environment variables

source /etc/environment

Verify JAVA_HOME is set correctly

echo $JAVA_HOME
info

The exact path to your Java installation may vary depending on your distribution and installation method.