Sample Header Ad - 728x90

How can I install Java 8 on Debian 11 (Bullseye)?

14 votes
3 answers
56806 views
[This answer](https://unix.stackexchange.com/a/542288/495409) explains _why_ it was removed. I'm not interested in the reason, instead, I need to install it. This VM is solely dedicated to my Java app, so I'm not really interested in using a container. That answer mentions that you can get it from the Stretch repos, but I don't want to create a Franken-Debian, so I'm not sure if that's a good idea or not. I need to install the Java 8 JRE, from OpenJDK. I installed Debian 11, and used an advanced installation due to a hypervisor bug*. Here's what I did to install it:
$ sudo apt update
...
$ sudo apt install openjdk-8-jre
Reading package lists... Done
Building dependency tree... Done
Building state information... Done
Package openjdk-8-jre is not available, but is referenced to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another sources
However the following packages replace it:
  nvidia-openjdk-8-jre

E: Package 'openjdk-8-jre' has no installation candidate
If it helps, here is my /etc/apt/sources.list file:
... commented lines ommitted ...

deb http://deb.debian.org/debian/  bullseye main non-free contrib
deb-src http://deb.debian.org/debian/  bullseye main non-free contrib

deb http://security.debian.org/debian/security  bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security  bullseye-security main contrib non-free

deb http://deb.debian.org/debian/bullseye-updates  main contrib non-free
deb-src http://deb.debian.org/debian/bullseye-updates  main contrib non-free
So, I tried [searching for it](https://packages.debian.org/search?keywords=openjdk&searchon=names&suite=stable§ion=all) ... and it isn't there (I'm using Bullseye/11 - the current stable release). Interestingly, [it is there in Debian Stretch](https://packages.debian.org/search?suite=stretch&searchon=names&keywords=openjdk) . Except... I want to use Bullseye, as it is stable, not Stretch. So how should I install the OpenJDK 8 JRE in Bullseye? Should I just add the Stretch repos to my sources.list? [They advise against doing that](https://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian) , so what is the proper way to get Java 8? --- *My hypervisor requires that grub-install has the --removable flag when using UEFI. IDK why it requires that, but I had to use the advanced install to enable the removable flag. That should be irrelevant, though.
Asked by cocomac (545 rep)
Apr 18, 2022, 11:35 PM
Last activity: Mar 16, 2023, 09:15 AM