Skip to main content
Back to Blog
Blog Article

How to Install Java 23 on Debian 10, 11, or 12

Install Java 23 on Debian 10, 11, or 12 with this easy step-by-step guide. Download and set up JDK 23 quickly on your Debian-based system.

October 23, 2024
3 min read
SharpHeberg
How to Install Java 23 on Debian 10, 11, or 12

If you’re working on a Debian-based system (Debian 10, 11, or 12) and need to install the latest Java Development Kit (JDK 23), follow these simple steps to get up and running in no time.

Steps to Install Java 23:

  1. Download the JDK 23 package:
    Use the wget command to download the JDK 23 .deb package from the official Oracle website.
wget https://download.oracle.com/java/23/archive/jdk-23.0.2_linux-x64_bin.deb
  • Install the downloaded package:
    Use dpkg to install the JDK 23 package on your Debian system.
dpkg -i jdk-23.0.2_linux-x64_bin.deb
  1. Clean up:
    Once the installation is complete, remove the downloaded .deb file to keep your system clean.
rm jdk-23.0.2_linux-x64_bin.deb

After the installation, you can check if Java is successfully installed by running:

java -version

This will display the installed Java version, confirming that JDK 23 is correctly set up on your Debian system.

Start building your Java applications with the latest tools!

Switching Between Java Versions on Debian

Once you’ve installed multiple versions of Java on your Debian system (for example, Java 11, 12, 13, or the latest Java 23), you might need to switch between them depending on the requirements of your projects. Here’s how you can easily change the default Java version using the update-alternatives command.

Steps to Switch Between Java Versions:

  1. Check the installed Java versions: First, check all the installed Java versions on your system by running:
update-alternatives --config java

This will list all available versions of Java on your system. You’ll see something like this:

There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
*  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-12-openjdk-amd64/bin/java      1122      manual mode
  3            /usr/lib/jvm/java-23-oracle/bin/java             1233      manual mode
  1. Select the desired Java version: To change the Java version, choose the appropriate selection number. For example, if you want to switch to Java 23 (which in this example is Selection 3), type:
sudo update-alternatives --config java

Then, type the number of the Java version you want to use and press Enter.

  1. Verify the change: After selecting the version, you can verify that the system is now using the new Java version by running:
java -version

This should display the version of Java you’ve just selected, confirming that the switch was successful.

Example Output:

java version "23.0.2" 2025-01-21
Java(TM) SE Runtime Environment (build 23.0.2+7-58)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.2+7-58, mixed mode, sharing)

You can now easily switch between Java versions depending on the needs of your applications or projects.

Note: If you also need to switch the version for javac, the Java compiler, you can use a similar command:

sudo update-alternatives --config javac

This flexibility makes it easy to manage multiple Java environments on a single machine without conflicts.

Related Articles

Continue exploring our knowledge base with these related articles

What Is a VPN and How Does It Work?
July 23, 20253 min read

What Is a VPN and How Does It Work?

In today’s digital world, your online activity is constantly exposed to hackers, advertisers, governments, and even your internet service provider (ISP). That’s why more people are turning to VPNs (Virtual Private Networks) to stay safe and private online. But what exactly is a VPN, and how does it work? This guide from SharpHeberg explains everything in simple terms. 💡 [ ]

Read Article
VPN Public Wi-Fi Protection: How to Stay Safe on Open Networks
July 16, 20252 min read

VPN Public Wi-Fi Protection: How to Stay Safe on Open Networks

VPN public Wi-Fi protection is essential when using open networks in cafés, airports, or hotels. While public Wi-Fi is convenient, it’s often unsecured leaving your personal data vulnerable to cyberattacks. When you connect to an open or shared network, your personal data can be exposed to hackers, trackers, and cybercriminals. That’s why using a VPN (Virtual Private Network) is [ ]

Read Article
Why Use a VPN? A Simple Guide
July 9, 20252 min read

Why Use a VPN? A Simple Guide

Why use a VPN in 2025? Because online privacy is more important than ever. A VPN (Virtual Private Network) helps you stay secure, anonymous, and free on the internet whether you re working, traveling, or just browsing. What Does a VPN Do? A VPN creates a secure, encrypted connection between your device and the internet. It hides your real IP [ ]

Read Article

Published on October 23, 2024 by SharpHeberg

Thank you for reading our technical insights and tutorials

Back to Blog