46

Can't install Java8

apt-get install openjdk-8-jre-headless
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-8-jre-headless : Depends: ca-certificates-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages

I've searched Google and I've added repos and other suggestions, but nothing has allowed me to install Java 8 yet.

ideas?

lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.7 (jessie)
Release:        8
Codename:       jessie
7
  • 1
    Facing the same problem here. It was working till yesterday. Today it initially complained about ca-certificates-java and now can't even find the package.
    – Jay
    Commented Feb 4, 2017 at 5:35
  • 1
    Just interesting, why don't you want to install oracle version?
    – ka3ak
    Commented Feb 4, 2017 at 7:26
  • @ka3ak what is the oracle install version? I tried doing an apt-get install with a package that had install and oracle in it but it did not work.
    – Jason
    Commented Feb 4, 2017 at 15:32
  • 1
    @FrankThornton Here is how I installed it on my system (Kubuntu): sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Source: webupd8.org/2012/09/…
    – ka3ak
    Commented Feb 4, 2017 at 16:14
  • Thanks! I was pretty sure I tried that or at least something kinda like that and had issues. I may have had a different repo.
    – Jason
    Commented Feb 4, 2017 at 16:23

5 Answers 5

90

is this jessie? With backports

apt install -t jessie-backports  openjdk-8-jre-headless ca-certificates-java
3
  • Backport issue looks like. That allowed it to install.
    – Jason
    Commented Feb 4, 2017 at 15:31
  • 1
    That worked for me, too. Mind adding an explanation what the -t parameter does and how this resolves the issue? Commented Apr 17, 2017 at 15:22
  • 1
    The option -t tells apt, from which source it should install the package. aptitude why-not ca-certificates-java gives p openjdk-8-jre-headless Beschädigt ca-certificates-java (< 20160321~) You need the Version from jessie-backports. apt-cache policy ca-certificates-java ca-certificates-java: Installiert: 20140324 Installationskandidat: 20140324 Versionstabelle: 20161107~bpo8+1 0 100 http://http.us.debian.org/debian/ jessie-backports/main amd64 Packages *** 20140324 0 500 http://http.us.debian.org/debian/ jessie/main amd64 Packages
    – user192526
    Commented Apr 18, 2017 at 8:34
9

It is not working from Jessie backports. I tried stretch and it got installed.

echo 'deb http://ftp.au.debian.org/debian/ stretch main contrib non-free' > /etc/apt/sources.list.d/stretch.list && \
apt-get update && \
apt-get install -y --no-install-recommends openjdk-8-jre-headless && \
rm /etc/apt/sources.list.d/stretch.list && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

P.S.: I used an Australian mirror since I am here. Choose the best for you from here.

0
3

this worked for me many thanks, note you got an extra 'deb' in your echo i had to remove, i am also in Oz but this should work on all repos by now, seems it was an issue with certificates for fixed list of java versions

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=851667

1
1

I keep hitting this issue. Very frustrating. I have automated packer builds and when the jdk/jre are updated this issue can resurface. after much hair pulling i've found this to be fairly reliable and fully automateable.

note that you mush have a backports repo properly defined as mentioned in other parts of this page. my image came with it pre set up. yours however, may not.

  1. install ca-certs from backports
  2. install jre and jdk + headless as a second command

    sudo apt install -t jessie-backports ca-certificates-java
    sudo apt-get -y install openjdk-8-jdk openjdk-8-jre openjdk-8-jdk-headless openjdk-8-jre-headless
    

running the two together will prompt for a Y/N response on a config file, which are annoying to automate. so they MUST be run separately if you want this to work w/o human interaction.

0

This works for me

apt-get install software-properties-common
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
apt-get update
apt-get install oracle-java8-installer

referring guide

You must log in to answer this question.

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