Java 22 Installation on Ubuntu server

Installation Guide for Java 22 (OpenJDK 22.0.1) on Ubuntu Server

 

Download Java 22 Package

# wget https://download.java.net/java/GA/jdk22.0.1/c7ec1332f7bb44aeba2eb341ae18aca4/8/GPL/openjdk-22.0.1_linux-x64_bin.tar.gz

 

Extract the Archive

Once the download completes, extract the tar.gz archive to a directory where you want to install Java. Typically, this can be /opt for system-wide installations:

 

# mkdir -p /opt/java/openjdk-22

# tar -xzvf openjdk-22.0.1_linux-x64_bin.tar.gz -C /opt/java/openjdk-22 --strip-components=1

 

Set Java Environment Variables

To use Java 22, you should set the JAVA_HOME and PATH environment variables. Edit your shell profile configuration file (e.g., ~/.bashrc, ~/.bash_profile, or /etc/profile.d/java.sh):

Open the file in a text editor (using vim in this example):

# vim /etc/profile.d/java.sh

Add the following lines to set JAVA_HOME and update the PATH:

export JAVA_HOME=/opt/java/openjdk-22

export PATH=$JAVA_HOME/bin:$PATH

 

Load the Environment Variables

To apply the changes to your current session, either log out and log back in, or source the script you just modified:

# source /etc/profile.d/java.sh

Verify Installation

Check if Java 22 is installed correctly by running:

# java -version

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to add IP Address to servers

1.Login to the server via RDP. 2.In the Run window type NCPA.CPL. 3.In the network properties...

How to configure IP's on Ubuntu 18?

To configure a static IP address on your Ubuntu 18.04 server you need to modify a relevant...

How to install Wordpress in webmin

  The following steps are followed for installing Wordpress in Webmin   Open File Manager in...

How to install Webmin in CentOs

  Installing webmin using YUM repository Create a .repo file using a command # nano...

How to install Virtualmin in webmin

  Steps for Installing Virtualmin on Webmin (Ubuntu):   Setting the hostname and FQDN For...

Powered by WHMCompleteSolution