java-8-openjdk-amd64 is already installed by default on my Debian testing system (Buster), and I would like to keep it installed.

openjdk-7-jdk is not in my testing package list.

According to its package page, it’s available on Jessie. So I added this repository :

deb http://security.debian.org/debian-security jessie/updates main

but OpenJDK 7 won’t install:

openjdk-7-jdk depends openjdk-7-jre but it is not going to be installed
openjdk-7-jre : depends: openjdk-7-jre-headless (= 7u151-2.6.11-2~deb8u1) but it is not going to be installed
openjdk-7-jre : Depends: libgif4 (>= 4.1.4) but it is not installable 

I know I can use update-alternatives to switch between several JDK versions, but how do I get OpenJDK 7 installed in the first place?

1 Answer 1


The security repository, which is what you’ve added, isn’t a standalone repository; to use it, you also need to add the corresponding “main” repository:

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

This would have allowed you to install OpenJDK 7 in the past; unfortunately, the Jessie package can no longer be installed in a Buster system because it ends up depending on tzdata-java, which needs a specific version of tzdata which can’t be satisfied without downgrading the Buster version.

There is another way to install OpenJDK 7 on a Buster system: you can install it from experimental. Add

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

to your repositories (and remove the Jessie entries while you’re at it), and run

apt install -t experimental openjdk-7-jdk
  • I still get openjdk-7-jre : Depends: openjdk-7-jre-headless (= 7u151-2.6.11-2~deb8u1) but it is not going to be installed. following through the chain of unsatisfied dependancies : tzdata-java : depends: tzdata (= 2017c-0+deb8u1) but 2018c-1 is to be installed
    – Albizia
    Mar 22, 2018 at 11:30
  • 1
    Ah yes, that means the Jessie package can’t be used in Buster. There is another solution; see my update. Mar 22, 2018 at 12:47
  • apt install -t experimental openjdk-7-jdk Reading package lists... Done Building dependency tree Reading state information... Done Package openjdk-7-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'openjdk-7-jdk' has no installation candidate
    – user390436
    Jun 13, 2020 at 21:13
  • @user390436 unfortunately this is one of those answers with a use-by date; two years later, OpenJDK 7 is no longer available in experimental. Jun 13, 2020 at 21:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .