You can download and install it in /opt/ so it does not interfere with the currently installed version. Commands:

Download:

wget https://download.java.net/java/GA/jdk18/43f95e8614114aeaa8e8a5fcf20a682d/36/GPL/openjdk-18_linux-x64_bin.tar.gz

Extract the download (replace {version} with the one downloaded):

tar -xvf openjdk-18._linux-{version}

Move it to /opt/:

sudo mv jdk-18* /opt/

(replace jdk-18 to something else if you want) and set the environment variables:

export JAVA_HOME=/opt/jdk-18
export PATH=$PATH:$JAVA_HOME/bin

To check if that went correctly:

cd /opt/jdk-18/
java --version
echo $JAVA_HOME

By re-doing the exports to exclude /opt/jdk-18 you restore the old situation

Answer from Rinzwind on askubuntu.com
🌐
ComputingForGeeks
computingforgeeks.com › home › install oracle java 18 (openjdk 18) on ubuntu / debian
Install Oracle Java 18 (OpenJDK 18) on Ubuntu / Debian [Guide]
September 29, 2023 - Step-by-step guide to oracle Java 18 (OpenJDK 18) on Ubuntu / Debian. Includes commands, verification, and troubleshooting.
🌐
Kifarunix
kifarunix.com › home › howtos › install java 11|java 17|java 18 on debian 11
Install Java 11|Java 17|Java 18 on Debian 11 - kifarunix.com
March 9, 2024 - There are no Java 18 packages available on the default Debian 11 repositories, as of this writing. If you want, you can install just JRE or JDK.
Discussions

java - I want to install JDK for Debian using ARM64 but I got todpkg: error: archive 'jdk-20.0.2' is not a regular file, how do I fix? - Stack Overflow
I tried to install Java IDK using https://www.oracle.com/java/technologies/downloads/#jdk18-linux and wget as well as uncompressing it using tar but when I tried to sudo apt dpkg install on it, it ... More on stackoverflow.com
🌐 stackoverflow.com
[deleted by user]
SDKMAN! should work. More on reddit.com
🌐 r/debian
12
4
April 7, 2024
How can i install Java 21 on Debian 12 without resorting to sid?
I recommend temurin jdk and they have their own packages. Zulu is also good. https://adoptium.net/installation/linux/ https://docs.azul.com/core/install/debian More on reddit.com
🌐 r/linux4noobs
26
25
July 15, 2024
How can I install jdk-18_linux-x64_bin.deb into a specific folder on Ubuntu?
Could you try to clarify further where the issue is? As you've probably seen from the article that you've linked, .deb files are just glorified archives that can be extracted. You should just be able to use the dpkg-deb command example they've provided: dpkg-deb -xv file.deb /path/to/where/extract In order to extract the JDK to whichever folder/path you prefer (or as you mentioned you can also just use their .tar.gz archive they provide and extract that). Is the issue that you're having not with extracting the JDK to a specific directory, but rather running the JDK afterwards? If so, that will probably just be a case of you needing to update your $PATH environmental variable to include the bin folder from the JDK you extracted, so that commands like java can be run without specifying a full path like /acsystem/JDK/bin/java. More on reddit.com
🌐 r/javahelp
3
1
May 18, 2022
🌐
Linux Hint
linuxhint.com › install-oracle-java-16-jdk-debian
How to Install Oracle Java JDK 18 on Debian and Ubuntu – Linux Hint
To begin installing JDK 18, visit the link https://www.oracle.com/java/technologies/downloads/, scroll down the page and find the tab with the JDK version you want. Find the proper package for your system. In our case, we will download the .deb package, which is compatible with Debian/Ubuntu ...
🌐
Desde Linux
blog.desdelinux.net › from linux › applications › java 18: installing and configuring oracle jdk 18 on debian 11
Java 18: Installing and configuring Oracle JDK 18 on Debian 11
May 6, 2022 - for downloading Java 18 (Oracle JDK 18) the following must be accessed link and download the .deb file willing to GNU / Linux distributions based on Debian stable. Once downloaded, we proceed to its installation in the preferred way, that is, ...
🌐
ITzGeek
itzgeek.com › home › how to's › linux › how to install oracle java jdk 18 on linux
How to Install Oracle Java JDK 18 on Linux | ITzGeek
April 25, 2022 - In some cases, you may need to install Oracle JDK 18 on the PATH location. sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-18/bin/java 1
🌐
Debian
wiki.debian.org › Java
Java - Debian Wiki
Each of them have a development environment (JDK) and a runtime (known as JRE, or Java Virtual Machines JVM). Here's a list of Java environment. Just run aptitude search "?provides(java-runtime)" on your system to list available packages). The default JRE/JDK installed in Debian isn't the same for all architecture.
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-on-debian-11
How To Install Java with Apt on Debian 11 | DigitalOcean
September 1, 2022 - In this guide, you will install different versions of the Java Runtime Environment (JRE) and the Java Developer Kit (JDK) using Apt. You’ll install OpenJDK a…
🌐
Oracle
docs.oracle.com › en › java › javase › 18 › install › installation-jdk-linux-platforms.html
3 Installation of the JDK on Linux Platforms - Java
July 6, 2022 - $ rpm -Uvh jdk-18.interim.update.patch_linux-x64_bin.rpm ... Delete the .rpm file if you want to save disk space. Exit the root shell. It is not required to reboot. The JDK installation is integrated with the alternatives framework. After installation, the alternatives framework is updated to reflect the binaries from the recently installed JDK. Java commands such as java, javac, javadoc, and javap can be called from the command line.
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › software & applications
[SOLVED] JDK 18 not installing, java -version still shows OpenJDK 11.0.15 - Linux Mint Forums
sudo apt update sudo apt install -y libc6-x32 libc6-i386 wget https://download.oracle.com/java/18/latest/jdk-18_linux-x64_bin.deb sudo dpkg -i jdk-18_linux-x64_bin.deb sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-18/bin/java 1 Please, share the complete terminal output ...
🌐
ComputingForGeeks
computingforgeeks.com › home › how to install java openjdk and oracle jdk on debian 13 / 12
Install Java OpenJDK and Oracle JDK on Debian 13/12 | ComputingForGeeks
April 19, 2026 - Either the install step failed (check apt install output for 404s on packages.adoptium.net) or your shell opened before the alternatives symlink was in place. Fix by opening a new shell or running hash -r. If the problem persists, confirm /usr/bin/java exists with ls -la /usr/bin/java. Now that Java is working, the next pieces depend on what you are building. If you are running a JVM app on Debian, you probably also need a reverse proxy, a database, and a CI pipeline.
🌐
ITzGeek
itzgeek.com › home › how to's › linux › debian › how to install java jdk on debian 11
How To Install Java JDK on Debian 11 - ITzGeek
August 28, 2021 - You can have multiple versions of Java (OpenJDK and Oracle Java) on your system. But, you can have only one default version. Installing OpenJDK in Debian is a pretty straightforward process.
🌐
Linuxiac
linuxiac.com › home › tutorials › how to install java on debian 12 (bookworm)
How to Install Java on Debian 12 (Bookworm)
August 4, 2023 - If you get a message like the one shown above, “java: command not found,” your system has not yet added support for Java, so let’s proceed with its installation. For clarity, we shall state right away that Debian provides the “default-jdk” meta-package, a regularly updated one to ship the latest version of the current OpenJDK LTS release for the convenience of its users.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-get-on-debian-8
How To Install Java with Apt-Get on Debian 8 | DigitalOcean
June 28, 2017 - When prompted to confirm the installation, type y for yes. To ensure that we get the correct source line on Debian, we’ll need to run the following command that also modifies the line: sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
🌐
Debian
tracker.debian.org › pkg › openjdk-18
openjdk-18 - Debian Package Tracker
[2021-08-26] Accepted openjdk-18 18~2-1 (source amd64 all) into experimental, experimental (Debian FTP Masters) (signed by: Matthias Klose)
🌐
Super User
superuser.com › questions › 1713212 › upgrade-java-8-to-java-18-in-linux
Upgrade java 8 to java 18 in linux - Super User
March 28, 2022 - Install the desired Java versions using your distribution's package manager. Then, configure the location of binary files for each Java tool (e.g., java, javac, javadoc) using update-alternatives:
🌐
Pi My Life Up
pimylifeup.com › home › installing newer versions of java on debian systems
Installing Newer Versions of Java on Debian Systems - Pi My Life Up
January 21, 2026 - In this quick guide, we will show you how to easily install the latest versions of Java on to your Debian based system.
🌐
Reddit
reddit.com › r/debian › [deleted by user]
[deleted by user] : r/debian
April 7, 2024 - You can use Amazon's Corretto JDK builds, for example: https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/generic-linux-install.html ... Note though that these are NOT available for Debian 12 as OP requested. They will have to either build them manually, or pin from sid; both options which come with drawbacks and aren't things I'd do in production -- which is why I linked to Amazon's supported builds, which in turn seems to have gotten some feathers ruffled. *shrug* ... The Adoptium Debian Repository provides OpenJDK packages for Java 8 (temurin-8-jdk).