I am trying to install sbt on Ubuntu 16.04. I have mistakenly stopped the process when running the following command,
sudo apt-get install sbt
Solution with 16.0.4:
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.*
it's so long time since you asked. Because of no answer here, I show you my solution that works well for me.
The root cause of your problem may be from previous java install (it's not from any repositories, but from manually download package). Thus, you must manually remove post-install scripts, use below commands:
sudo rm /var/lib/dpkg/info/oracle-java8-installer.postinst -f
sudo dpkg --configure oracle-java8-installer
Hope them help you.
For Ubuntu 19.04 and Oracle JDK 11:
sudo rm /var/lib/dpkg/info/oracle-java11-installer-local.postinst -f
sudo dpkg --configure oracle-java11-installer-local
The following worked in Ubuntu 18.10
cd /var/lib/dpkg/info
sed -i 's|JAVA_VERSION=8u191|JAVA_VERSION=8u201|' oracle-java8-installer.*
sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/|' oracle-java8-installer.*
sed -i 's|SHA256SUM_TGZ="53c29507e2405a7ffdbba627e6d64856089b094867479edc5ede4105c1da0d65"|SHA256SUM_TGZ="cb700cc0ac3ddc728a567c350881ce7e25118eaf7ca97ca9705d4580c506e370"|' oracle-java8-installer.*
sed -i 's|J_DIR=jdk1.8.0_191|J_DIR=jdk1.8.0_201|' oracle-java8-installer.*
!! NOTE !! This solution may not work if Oracle stops serving files from their FTP service. They do that for older Java releases.
When using ppa:webupd8team/java
there can be deprecated/archived Oracle links hardcoded in PPA.
Oracle is moving their older versions to archive and PPA has internal links to "active" (at the time of PPA creation) Oracle download versions.
The maintainer of ppa:webupd8team/java
is only one man - Andrew (see here)
Problem
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)
Solution
cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' 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/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.*
Java versions change "often" so update
8u151
and8u162
to reflect your environment. (this versions worked on Ubuntu 16.04.3 LTS - 2018-01-18)
Try again
apt install oracle-java8-installer
apt install oracle-java8-set-default
Read more about the problem