21

I am attempting to install java7 in a docker image. This was working till a few days ago. Commands are:

    apt-get --fix-missing update
    apt-get -y upgrade

    apt-get -y install software-properties-common
    add-apt-repository ppa:webupd8team/java
    apt-get -y upgrade
    apt-get -y update

    echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
    apt-get install -y oracle-java7-installer

Output is:

       Setting up oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...
       debconf: unable to initialize frontend: Dialog
       debconf: (TERM is not set, so the dialog frontend is not usable.)
       debconf: falling back to frontend: Readline
       debconf: unable to initialize frontend: Readline
       debconf: (This frontend requires a controlling tty.)
       debconf: falling back to frontend: Teletype
       Downloading Oracle Java 7...
       --2017-05-29 16:54:29--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
       Resolving download.oracle.com (download.oracle.com)... 104.96.220.162, 104.96.220.106
       Connecting to download.oracle.com (download.oracle.com)|104.96.220.162|:80... connected.
       HTTP request sent, awaiting response... 302 Moved Temporarily
       Location: (REMOVING H-T-T-P-S BECAUSE I DON'T HAVE ENOUGH REP POINTS)://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]
       --2017-05-29 16:54:29--  (REMOVING H-T-T-P-S BECAUSE I DON'T HAVE ENOUGH REP POINTS)://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
       Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.196.115.62, 2600:1408:10:184::2d3e, 2600:1408:10:185::2d3e
       Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.196.115.62|:443... connected.
       HTTP request sent, awaiting response... 302 Moved Temporarily
       Location: (REMOVING H-T-T-P BECAUSE I DON'T HAVE ENOUGH REP POINTS)//download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1496076904_47c6805122b1f8131f00e210452116ca [following]
       --2017-05-29 16:54:29--  http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1496076904_47c6805122b1f8131f00e21                                                0452116ca
       Connecting to download.oracle.com (download.oracle.com)|104.96.220.162|:80... connected.
       HTTP request sent, awaiting response... 404 Not Found
       2017-05-29 16:54:31 ERROR 404: Not Found.

       download failed
       Oracle JDK 7 is NOT installed.
       dpkg: error processing package oracle-java7-installer (--configure):
       subprocess installed post-installation script returned error exit status 1
       Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2ubuntu1) ...
       Setting up x11-common (1:7.7+1ubuntu8.1) ...
       debconf: unable to initialize frontend: Dialog
       debconf: (TERM is not set, so the dialog frontend is not usable.)
       debconf: falling back to frontend: Readline
       debconf: unable to initialize frontend: Readline
       debconf: (This frontend requires a controlling tty.)
       debconf: falling back to frontend: Teletype
       invoke-rc.d: policy-rc.d denied execution of start.
       Processing triggers for ureadahead (0.100.0-16) ...
       Setting up xfonts-encodings (1:1.0.4-1ubuntu1) ...
       Setting up xfonts-utils (1:7.7+1) ...
       Setting up gsfonts-x11 (0.22) ...
       Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
       Errors were encountered while processing:
        oracle-java7-installer
       E: Sub-process /usr/bin/dpkg returned an error code (1)
       The command '/bin/sh -c apt-get install -y oracle-java7-installer'            returned a non-zero code: 100
  • They have simple PPA way, I don't know why you tried commands like echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections simply sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer – Ege Sucu May 29 '17 at 17:31
  • What is the simple PPA way you're talking about? This is using the webupd8 method. That's exactly where oracle-java7-installer comes from. – TobisTobogan May 29 '17 at 17:34
  • 1
    I have exactly the same problem. It seems that the ppa is out of data or the url to the download file has been changed. – headmyshoulder May 31 '17 at 3:13
  • You're likely facing a problem I answered here: stackoverflow.com/questions/44213454/… – doz10us Jun 1 '17 at 15:08
  • Emailed the maintainer about this, he said they won't fix it. So either upgrade to JDK8 if you want to keep using the webupd8 PPA or download & install it manually. – dvdgsng Jun 2 '17 at 14:53
15

The cause of the error is Oracle's removal of the binaries from their site. Though the versions were deprecated a while ago, the binaries were still there for download until recently. But they removed it now.

This is explained in webupd8's site on June 2,2017. Oracle's download page says

Updates for Java SE 7 released after April 2015, and updates for Java SE 6 released after April 2013 are only available to Oracle Customers through My Oracle Support (requires support login).

Java SE Advanced offers users commercial features, access to critical bug fixes, security fixes, and general maintenance".

Check the full details here http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html.

  • so what about the dependencies of old pieces of the software, which points to java 7? – Dee Sep 24 '17 at 12:07
  • @Dee Which software are you talking about? No software should explicitly depends on java7, but if you find one, I can add details on how to make that work. – Anwar Sep 24 '17 at 14:25
22

Since Oracle has moved the download link and requires login credentials to download older versions of java, follow the following steps to install java 7:

1) Download latest java version from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html. You will need to login.

2) Delete jdk-7uXX-linux-x64.tar.gz from /var/cache/oracle-jdk7-installer/ where XX is the version number.

3) Move the downloaded version into /var/cache/oracle-jdk7-installer/ using the following command

sudo mv jdk-7u(downloadedversion)-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/


4) Now run the following command

sudo apt-get install oracle-java7-installer



  • 1
    Followed many posts nothing worked. 3rd step does the magic. – Anupama Boorlagadda Oct 3 '17 at 13:41
  • What would be the right moment to perform that overwrite? Before apt-get install -y oracle-java7-installer? Obviously there is no installer yet, so how can I mv the jdk ? And if I perform the install it will fail. I can only download the package but still it will not be unpacked yet so no files in /var/cache right? – MorioBoncz Oct 19 '17 at 13:19
  • This doesn't work. It just says E: Package 'oracle-java7-installer' has no installation candidate. – August Lilleaas Nov 7 '17 at 17:25
  • @AugustLilleaas first you need to add the actual ppa see the original answer, then apt-get update and then you'll have the package – alonisser Jan 12 '18 at 14:32
  • Unfortunately, adding the PPA doesn't help. I added it with add-apt-repository ppa:webupd8team/java, and that repo has no oracle-java7-installer package provided – August Lilleaas Jan 17 '18 at 17:04
0

As mentioned in other answers Oracle requires a developer account or a support contract to download anything but the latest version of the JRE/JDK from their site since they typically do a release to address severe CVE (vulnerabilities).

This repository has a script that allows you to download the latest or older versions based on the parameters and environment variables you set.

https://github.com/vjkoskela/jdk-wrapper

0

Figured I'd post here in case anyone ran into this issue with Oracle moving from Java 181 to 191 yesterday. If you're getting this issue with Java 8 please look here for the fix until the new Java 8 installer has been updated for Ubuntu.

Here is the fix for 181 to 191:

cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u181|JAVA_VERSION=8u191|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="1845567095bfbfebd42ed0d09397939796d05456290fb20a83c476ba09f991d3"|SHA256SUM_TGZ="53c29507e2405a7ffdbba627e6d64856089b094867479edc5ede4105c1da0d65"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_181|J_DIR=jdk1.8.0_191|' oracle-java8-installer.* 

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.