Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
The following packages were automatically installed and are no longer required:
libllvm3.8 libpango1.0-0 linux-headers-4.4.0-101
linux-headers-4.4.0-101-generic linux-image-4.4.0-101-generic
linux-image-extra-4.4.0-101-generic linux-signed-image-4.4.0-101-generic
ubuntu-core-launcher
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 9 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] Y
Setting up oracle-java7-installer (7u80+7u60arm-0~webupd8~1) ...
Downloading Oracle Java 7...
--2018-03-16 19:02:01-- http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 2.19.56.117
Connecting to download.oracle.com (download.oracle.com)|2.19.56.117|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]
--2018-03-16 19:02:08-- https://edelivery.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.125.31.54, 2a02:26f0:5c:18a::2d3e, 2a02:26f0:5c:19c::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.125.31.54|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1521207256_c474be83dd84663bea2f4b9de8ad5cd2 [following]
--2018-03-16 19:02:16-- http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1521207256_c474be83dd84663bea2f4b9de8ad5cd2
Connecting to download.oracle.com (download.oracle.com)|2.19.56.117|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-03-16 19:02:19 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
E: Sub-process /usr/bin/dpkg returned an error code (1)
在" sudo apt-get install build-essential"上面给出了上述错误命令和JDK 7已经安装。我也尝试过Java程序来检查JDK安装
答案 0 :(得分:1)
试试这个解决方案:
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.*
现在尝试使用以下命令重新安装:
apt install oracle-java8-installer
apt install oracle-java8-set-default
我希望这会帮助你并解决你的问题。这也解决了我的问题。