Oracle Java 23 has been released for the Java SE platform. Since this is a long-term support (LTS) version, it will be supported until March 2025. It includes many improvements and bug fixes. If you are using a workstation, you should consider upgrading to this version. Production users should upgrade only after making sure all their applications are compatible.

This blog post will help you install Oracle Java 23 on Ubuntu 24.04 LTS, 22.04 LTS, 20.04 LTS, and 18.04 LTS systems using the official Debian file. Follow the steps below to install Java on the Ubuntu command line.

Advertisement

How to Install Oracle Java 23 on Ubuntu 24.04 & 22.04 install java install jdk Java jdk jre

Step 1: Download Java 23 Debian File

Oracle Java Debian packages are available for download from the official site. You can visit Oracle Java Downloads Page for more information and updates. Open a terminal and run the command below to download the Java 23 package:

wget https://download.oracle.com/java/23/latest/jdk-23_linux-x64_bin.deb

Step 2: Install the Downloaded Package

You will find the downloaded Java Debian file in the Downloads directory or your current working directory if you used the command line to download it. Go to the directory where the installer file is located.

cd ~/Downloads

Next, install the Debian file using the apt package manager.

sudo apt install -f jdk-23_linux-x64_bin.deb

After the package is successfully installed, you can check the installed version by running the following command.

java -version
 

java version "23.0.1" 2024-10-15
Java(TM) SE Runtime Environment (build 23.0.1 11-39) 
Java HotSpot(TM) 64-Bit Server VM (build 23.0.1 11-39, mixed mode, sharing)

Step 3: Set Up JAVA_HOME and JRE_HOME Variables

The installer script automatically sets the environment variables for you. You can check these variables in the /etc/profile.d/jdk.sh script.

sudo nano /etc/profile.d/jdk.sh 
 

export J2SDKDIR=/usr/lib/jvm/java-23-oracle-64
export J2REDIR=/usr/lib/jvm/java-23-oracle-64
export PATH=$PATH:/usr/lib/jvm/java-23-oracle-64/bin:/usr/lib/jvm/java-23-oracle-64/db/bin
export JAVA_HOME=/usr/lib/jvm/java-23-oracle-64
export DERBY_HOME=/usr/lib/jvm/java-23-oracle-64/db

Conclusion

You have now successfully installed Oracle Java 23 on your Linux system. By following these steps, you can easily set up Java for your development or production environment. If you’re running Java-based web applications, you may also need to install a Tomcat server. Always ensure that your applications are compatible with the new version before upgrading.