Videos
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...
Alternatively, you can use adoptopenjdk repository:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot
https://adoptopenjdk.net/installation.html
WARNING: this answer suggest unsupported and dangerous mixing of Debian releases. Follow the advice on your own risk, as it can break the system on upgrades, as explained in http://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian
Package mirror search steps:
In the Search package directories search for openjdk-8-jdk. You can see two results:
- stretch (oldstable) (java): OpenJDK Development Kit (JDK)
- sid (unstable) (java): OpenJDK Development Kit (JDK)
Choose stretch repository
Scroll to the Download openjdk-8-jdk section and choose your architecture. For example amd64
Now you can see mirrors list and instructions how to install the package via apt:
You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:
deb http://security.debian.org/debian-security stretch/updates main
Installation steps:
Install software source manager
apt-get update apt-get install software-properties-commonAdd mirror with openjdk-8-jdk
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' apt-get updateInstall openjdk 8
apt-get install openjdk-8-jdk
Note: You can use steps above to find an official Debian mirror with any other package you want to install
Copies of past Debian packages are available at http://snapshot.debian.org/
You can search there for openjdk-8. The last available version is 8u322-b06-1~deb9u1, logged at http://snapshot.debian.org/package/openjdk-8/8u322-b06-1%7Edeb9u1/ You can download the binary packages (.deb) for your architecture and install with sudo dpkg -i *.deb.
Whether it works or not depends on the library versions that it was built against. 8u312-b07-1 (and other older versions) is also available.
Alternatively you can access the Debian tracking page for the package at https://tracker.debian.org/pkg/openjdk-8. openjdk-8 is still listed there as available for unstable (as version 8u312-b07-1). If you click on the links for the binary packages, they will lead you to download links for the deb packages.
snapshot.debian.org is arguably simpler for ad-hoc downloading since it has the deb files in one place (the debian package repository finds them in http://ftp.us.debian.org/debian/pool/main/o/openjdk-8/ or its mirror sites)
snapshot.debian.org also suggests instructions for configuring sources.list. But if the package is not likely to be updated often then it might be simpler to just download the deb files manually.
Since Oracle changed Java licensing, Bellsoft (not affiliated) has done a great job at providing openJDK installers. They just work, and you can choose between:
- JDK / JRE
- Java 8 / 11 / 17 / 19
- With or without JavaFX
- Windows / Debian / Redhat / Alpine / Solaris / macOs installer
You'll surely find the correct installer at https://bell-sw.com/pages/downloads/#/java-8-lts.
You can install multiple Java versions if you wish. If you need to juggle between versions, you might be interested in this answer.