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 Answer from deke28 on reddit.com
🌐
TecMint
tecmint.com › home › debian › how to install java jdk 21 on debian 12
How to Install Java 21 (JDK) on Debian 12
June 27, 2024 - The easiest way to install Java 21 on Debian 12 is by using the apt package manager as a regular user with sudo privileges and updating the system packages as shown.
🌐
Reddit
reddit.com › r/linux4noobs › how can i install java 21 on debian 12 without resorting to sid?
r/linux4noobs on Reddit: How can i install Java 21 on Debian 12 without resorting to sid?
July 15, 2024 -

EDIT: I've ended up installing Microsoft's OpenJDK 21. Had a nice instructions to setup and i didnt need to mess up my debian repositories to get the thing (only add MS one). Sorry die-hard Linux fans

I'm trying to install the JRE of Java 21 in my Debian 12 headless machine, for Minecraft server purposes.

Unfortunately i saw that the packages of 21 aren't available in stable repositories, only on sid (unstable). I don't want to add the whole sid repository to avoid instability and since the only package i want is this one.

So, is there any way to install Java 21 using either apt or a .deb file - without resorting to unpack a .tar.gz? Should i download the .deb on the website and try to install it via gdebi-core? I read that this isn't an advised thing to do due to dependencies and such...

Discussions

How can I install Java 8 on Debian 12 (bookworm)? - Unix & Linux Stack Exchange
Is there a way to install Java 8 JDK (not the runtime) on a Debian 12? More on unix.stackexchange.com
🌐 unix.stackexchange.com
June 26, 2023
Java installation Debian 12
No intention to be RTFM but I found this. Hopefully it helps. https://wiki.debian.org/Java More on reddit.com
🌐 r/debian
4
0
August 13, 2023
Comment installer Java 8 sur Debian 12 ?
Subreddit pour discuter de tout ce qui concerne Debian, le système d'exploitation universel · Create your account and connect with a world of communities More on reddit.com
🌐 r/debian
12
4
April 7, 2024
Hulp bij het installeren van OpenJDK-11 op Debian 12

Ik weet niet zeker of er een "juiste" manier is, behalve een container of een VM, die hun eigen beperkingen hebben. Ik heb geprobeerd bullseye (Debian 11) toe te voegen aan /etc/apt/sources.list en openjdk-11-jdk te installeren, en het lijkt te werken. Ik ben echter geen Java-ontwikkelaar en kan niet testen of het correct is ingesteld. java --version ziet er goed uit.

deb http://deb.debian.org/debian bullseye main

Er is ook een distributie van OpenJDK genaamd "Temurin" die zou kunnen werken.

https://adoptium.net/installation/linux/

More on reddit.com
🌐 r/linux4noobs
4
4
June 21, 2023
🌐
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 ...
🌐
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. So, using the APT command below will install OpenJDK 17 LTS on your Debian 12 (Bookworm) system.
🌐
Slideshare
slideshare.net › home › technology › how to install java on debian 12 using apt and deb.pdf
How to Install Java on Debian 12 Using Apt and Deb.pdf
May 10, 2025 - Step 3: Install Java Using Apt Choose the version of Java you would like to install from the available options and run the command below to install it on your Debian 12: sudo apt install default-jdk -y ... 3/7 The command promptshows that the ...
🌐
idroot
idroot.us › home › how to install java on debian 12
How To Install Java on Debian 12 - idroot
August 11, 2025 - I will show you the step-by-step installation of Java programming language on a Debian 12 (Bookworm).
🌐
GitHub
gist.github.com › ansulev › 1b924e87bd091b1d78e06d918faa8fcf
Install Java 8 or 11 on Debian 12 · GitHub
Install Java 8 or 11 on Debian 12. GitHub Gist: instantly share code, notes, and snippets.
Find elsewhere
🌐
LinuxBuzz
linuxbuzz.com › home › how to's › how to install java on debian 12
How to Install Java on Debian 12
January 26, 2024 - $ wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb · Execute the following dpkg command to install above downloaded oracle jdk Debian package.
🌐
Ralph's Open Source Blog
ralph.blog.imixs.com › 2024 › 01 › 24 › install-open-jdk-11-on-debian-12-bookworm
Install Open JDK 11 on Debian 12 (Bookworm) - Ralph's Open Source Blog
January 24, 2024 - $ sudo apt update $ sudo apt install openjdk-11-jdk $ sudo update-alternatives --config java · The last command allows you to switch between JDK 17 and JDK 11. This does not work anymore even with added non-free-firmware after non-free within /etc/apt/sources.list.
🌐
Linux Genie
linuxgenie.net › home › how to install java on debian 12?
How to Install Java on Debian 12? - Linux Genie
December 1, 2023 - To install Java on Debian 12, execute the “sudo apt install default-jdk” command to install the latest version of JDK available on the apt repository.
🌐
Linux Hint
linuxhint.com › install-java-debian
How to Install Java on Debian 12: A Step By Step Guide – Linux Hint
You can install Java on Debian from apt package manager, deb file and SDKMAN. For more details, read this guide.
🌐
Greenwebpage
greenwebpage.com › home › blog › how to install java on debian 12: using apt and deb
How to Install Java on Debian 12: Using Apt and Deb
May 10, 2025 - This tutorial walks you through steps to install Java on Debian 12 using both apt package manager and .deb.
🌐
Ultimate Systems Blog
blog.usro.net › ultimate systems blog › how-to › linux › how to install java on debian 12
How to Install Java on Debian 12 – Ultimate Systems Blog
October 27, 2024 - Sometimes you might need more than one Java version—say you’re developing applications that need both Java 8 and Java 17 (a typical developer’s dilemma). No problem; Debian 12 can handle it. Install both versions:sudo apt install openjdk-8-jdk ...
🌐
Debian
debian.club › installing java
Installing Java | Debian.Club
3 weeks ago - Debian's apt package manager makes installing and updating Java very simple and secure. OpenJDK is the official open-source reference implementation of the Java SE platform. It is powerful, performs excellently, and is backed by broad community support. For the vast majority of development and production environments, OpenJDK is an outstanding choice. The default Java version in Debian 12 ...
🌐
Reddit
reddit.com › r/debian › java installation debian 12
r/debian on Reddit: Java installation Debian 12
August 13, 2023 -

Hi guys i'm trying to install java on my debian 12 but it allways gives me error(1)
I'm using this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-debian-11#step-1-installing-java .

My console problem :tomeczek@debian:**~**$ sudo apt install default-jdk
[sudo] password for tomeczek:  
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
default-jdk is already the newest version (2:1.17-74).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
9 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [T/n] t
Setting up ca-certificates-java (20230103) ...
Exception in thread "main" java.lang.InternalError: Error loading java.security file
at java.base/java.security.Security.initialize(Security.java:106)
at java.base/java.security.Security$1.run(Security.java:84)
at java.base/java.security.Security$1.run(Security.java:82)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.base/java.security.Security.<clinit>(Security.java:82)
at java.base/sun.security.jca.ProviderList.<init>(ProviderList.java:178)
at java.base/sun.security.jca.ProviderList$2.run(ProviderList.java:96)
at java.base/sun.security.jca.ProviderList$2.run(ProviderList.java:94)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.base/sun.security.jca.ProviderList.fromSecurityProperties(ProviderList.java:93)
at java.base/sun.security.jca.Providers.<clinit>(Providers.java:55)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:156)
at java.base/java.security.cert.CertificateFactory.getInstance(CertificateFactory.java:193)
at org.debian.security.KeyStoreHandler.<init>(KeyStoreHandler.java:50)
at org.debian.security.UpdateCertificates.<init>(UpdateCertificates.java:65)
at org.debian.security.UpdateCertificates.main(UpdateCertificates.java:51)
dpkg: error processing package ca-certificates-java (--configure):
installed ca-certificates-java package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of openjdk-17-jre-headless:amd64:
openjdk-17-jre-headless:amd64 depends on ca-certificates-java (>= 20190405~); however:
 Package ca-certificates-java is not configured yet.

dpkg: error processing package openjdk-17-jre-headless:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-17-jre:amd64:
openjdk-17-jre:amd64 depends on openjdk-17-jre-headless (= 17.0.8+7-1~deb12u1); however:
 Package openjdk-17-jre-headless:amd64 is not configured yet.

dpkg: error processing package openjdk-17-jre:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre:
default-jre depends on openjdk-17-jre; however:
 Package openjdk-17-jre:amd64 is not configured yet.

dpkg: error processing package default-jre (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-17-jdk:amd64:
openjdk-17-jdk:amd64 depends on openjdk-17-jre (= 17.0.8+7-1~deb12u1); however:
 Package openjdk-17-jre:amd64 is not configured yet.

dpkg: error processing package openjdk-17-jdk:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of minecraft-launcher:
minecraft-launcher depends on default-jre; however:
 Package default-jre is not configured yet.

dpkg: error processing package minecraft-launcher (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of openjdk-17-jdk-headless:amd64:
openjdk-17-jdk-headless:amd64 depends on openjdk-17-jre-headless (= 17.0.8+7-1~deb12u1); however:
 Package openjdk-17-jre-headless:amd64 is not configured yet.

dpkg: error processing package openjdk-17-jdk-headless:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jdk:
default-jdk depends on default-jre (= 2:1.17-74); however:
 Package default-jre is not configured yet.
default-jdk depends on openjdk-17-jdk; however:
 Package openjdk-17-jdk:amd64 is not configured yet.

dpkg: error processing package default-jdk (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jdk-headless:
default-jdk-headless depends on openjdk-17-jdk-headless; however:
 Package openjdk-17-jdk-headless:amd64 is not configured yet.

dpkg: error processing package default-jdk-headless (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
ca-certificates-java
openjdk-17-jre-headless:amd64
openjdk-17-jre:amd64
default-jre
openjdk-17-jdk:amd64
minecraft-launcher
openjdk-17-jdk-headless:amd64
default-jdk
default-jdk-headless
E: Sub-process /usr/bin/dpkg returned an error code (1)
tomeczek@debian:**~**$

🌐
LinuxCapable
linuxcapable.com › home › debian › how to install openjdk 25 on debian 13, 12 and 11
How to Install OpenJDK 25 on Debian 13, 12 and 11 - LinuxCapable
May 11, 2026 - Debian 13 resolves it to OpenJDK 21, Debian 12 resolves it to OpenJDK 17, and Debian 11 resolves it to OpenJDK 11, so install the explicit OpenJDK 25 or Temurin 25 package when your application requires Java 25.