1

I have a problem while trying to install third-party component Oracle Java 8. Every time I type:

$ sudo apt-get install oracle-java8-installer

I get this answer:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
oracle-java8-installer is already the newest version (8u131-1~webupd8~2).
The following package was automatically installed and is no longer required:
  snap-confine
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up oracle-java8-installer (8u131-1~webupd8~2) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2017-07-05 15:57:12--  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 2.22.144.107, 2.22.144.51
Connecting to download.oracle.com (download.oracle.com)|2.22.144.107|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-07-05 15:57:12 ERROR 403: Forbidden.

download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

I think I couldn't install Oracle JDK 8. I tried so hard to do this, but I got this error.

1

This is caused by the fact that the PPA maintainer hasn't updated their scripts yet and older updates of Java 8 are no longer available from Oracle.

To quickly resolve this, you can do the following and install 8u151. (This will only work so long as 8u151 is available from Oracle)

1) Install as normal:

echo debconf shared/accepted-oracle-license-v1-1 select true | sudo 
debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo add-apt-repository ppa:webupd8team/java
sudo apt update

Once that is done and you get the error:

Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:

oracle-java8-installer E: Sub-process /usr/bin/dpkg returned an error code (1)

2) You will then have to do the following for 8u151 to be installed:

cd /var/lib/dpkg/info
sudo sed -i 's|SHA256SUM_TGZ="e8a341ce566f32c3d06f6d0f0eeea9a0f434f538d22af949ae58bc86f2eeaae4"|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|' oracle-java8-installer.*
sudo sed -i 's|JAVA_VERSION=8u144|JAVA_VERSION=8u151|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_144|J_DIR=jdk1.8.0_151|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/$FILENAME|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/$FILENAME|' oracle-java8-installer.*

3) Once you complete the above, you can run the install again and it will succeed.

sudo apt install -y oracle-java8-installer
| improve this answer | |
0

You got this 403:Forbidden error:

Resolving download.oracle.com (download.oracle.com)... 2.22.144.107, 2.22.144.51
Connecting to download.oracle.com (download.oracle.com)|2.22.144.107|:80... connected. 
HTTP request sent, awaiting response... 403 Forbidden  
2017-07-05 15:57:12 ERROR 403: Forbidden.

because the Oracle Java 8 installer requires you to accept the Oracle license before the installation begins. You can run the following command to automatically accept the Oracle license:

echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections  

Alternatively you can download the JDK tar.gz archive manually from Java SE Downloads and place it under /var/cache/oracle-jdk8-installer then installing the oracle-java8-installer package will use the local archive instead of trying it to download it itself.

| improve this answer | |

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.