2

I just recently upgraded from 17.04 to 17.10, but in doing so ubuntu semes to have "forgotten" about my JDK 8 installation.

I can still use java:

olian04:~$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

But whenever i atempt to install a package, or clean away unused ones, I'm greeted by this:

Connecting to download.oracle.com (download.oracle.com)|92.122.94.143|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-20 16:35:41 ERROR 404: Not Found.

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)

So my question is, how would i fix this? I'm fine with either purging the old version and reinstalling it again, or hooking up my actual java install with ubuntu again ("reminding" it where java is installed) or just leaving the faulty java 8 install behind and grabbing a new java 9. I just have no idea how to do any of this...

I've tried just installing openjdk-9-jdk but since I'm not allowed to install any packaged without Java complaining about JDK 8 not being installed.... I'm kind of out of ideas...

Olian04
  • 4,653
  • I've posted a possible solution, however the "404 error" you have there is unrelated. Do you have extra JDK repositories in your sources list ? Or why would apt do download from oracle ? – Robert Riedl Jan 20 '18 at 16:43

2 Answers2

1

The version of Java 8 that WebUpd8 provides (8u151) is outdated and no longer provided by Oracle, so it gives an HTTP 404 (not found) error. Here's another answer that provides a temporary fix:


This problem occurred again because version 151 has been archived. This version is referenced currently by the PPA. You can use the following commands to update the reference to 161:

cd /var/lib/dpkg/info

sudo sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u161|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="6dbc56a0e3310b69e91bb64db63a485bd7b6a8083f08e48047276380a0e2021e"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_161|' oracle-java8-installer.*

Then, try sudo apt update; sudo apt upgrade.

Chai T. Rex
  • 5,193
0

You could try to get your apt in order with

apt-get install --fix-broken

if that doesn help, we can go deeper, to dpkg

dpkg -P oracle-java8-installer

or

dpkg -r -P openjdk-8-jdk

whatever the exact package name is ! You can see all your packages with

dpkg -l

and grepfor java or jdk

Once you have removed the faulty install and apt is content again, you can do a fresh install of either java8 or java9.

Robert Riedl
  • 4,351