9

This answer 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... and it isn't there (I'm using Bullseye/11 - the current stable release). Interestingly, it is there in Debian Stretch. 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, 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.

1
  • 3
    Java 8 is the Python 2 of Java ecosystem :,-(
    – JohnEye
    Apr 19, 2022 at 11:12

3 Answers 3

4

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.

1
  • 2
    Configuring sources.list entries for snapshots only makes it simpler to install packages and their dependencies. The entries are tied to a specific snapshot so they will never get updates. Apr 19, 2022 at 7:23
2

Go to Adoptium*. Go to the releases page, select Linux for the OS, x64 for the Architecture (assuming you have an AMD64/x64 machine), select 8 for the version, and select JRE under package type (or if you need to compile code, select JDK), and download the tar.gz file.

Extract the file:

$ tar xf OPENJDK8U-[something].tar.gz

Go into the extracted directory, and go into the bin folder (I accidentally got the JDK instead of the JRE, so I'll demo using that):

cd jdk8u[something]
cd bin

See if the version is right:

$ ./java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Temurin)(build [something])
OpenJDK 64-Bit Server VM (Temurin)(build [something], mixed mode)

And let's add that to our path:

export PATH=$PATH:/path/to/it/jdk8u322-b06/bin

If you want it always in the path, add it to your ~/.bashrc file (if you're using Bash, of course).

Now test it:

$ cd ~
$ java -version
...

Done!


*They make pre-compiled OpenJDK, they were formerly AdoptOpenJDK

1
  • Concerning a Debian system, it would be wiser to recommend installation of package temurin-8-jdk from APT source according to adoptium.net/installation/linux/… so that system automatically receive updates Jan 30 at 7:56
2

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.

1
  • 1
    +1 They sure made that easy enough!
    – dhempler
    Mar 15 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.