在Ubuntu上安装Oracle 8 JDK

时间:2018-01-18 19:52:47

标签: java java-8 ubuntu-16.04 wget

我收到以下错误:

Setting up oracle-java8-installer (8u151-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2018-01-18 19:36:08--  http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.104.142.192
Connecting to download.oracle.com (download.oracle.com)|104.104.142.192|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz [following]
--2018-01-18 19:36:08--  https://edelivery.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 2a02:26f0:d2:280::2d3e, 2a02:26f0:d2:296::2d3e, 23.40.218.189
Connecting to edelivery.oracle.com (edelivery.oracle.com)|2a02:26f0:d2:280::2d3e|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516304289_6e7f201fb7eb1023c58104b7dd4cdec1 [following]
--2018-01-18 19:36:09--  http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516304289_6e7f201fb7eb1023c58104b7dd4cdec1
Connecting to download.oracle.com (download.oracle.com)|104.104.142.192|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-01-18 19:36:10 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
dpkg: dependency problems prevent configuration of default-jdk-headless:
 default-jdk-headless depends on openjdk-8-jdk-headless; however:
  Package openjdk-8-jdk-headless is not installed.
  Package oracle-java8-installer which provides openjdk-8-jdk-headless is not configured yet.

dpkg: error processing package default-jdk-headless (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jdk:
 default-jdk depends on default-jdk-headless (= 2:1.8-56ubuntu2); however:
  Package default-jdk-headless is not configured yet.
 default-jdk depends on openjdk-8-jdk; however:
  Package openjdk-8-jdk is not installed.
  Package oracle-java8-installer which provides openjdk-8-jdk is not configured yet.

dpkg: error processing package default-jdk (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                         Errors were encountered while processing:
 oracle-java8-installer
 default-jdk-headless
 default-jdk
E: Sub-process /usr/bin/dpkg returned an error code (1)

以某种方式/var/cache/oracle-jdk8-installer存在jdk-8u151-linux-x64.tar.gz,每次我尝试安装甚至sudo apt-get autoremove时都会抛出上述错误。

Ubuntu试图获取JDK的错误消息中的链接不再存在于Oracle网站上。

我尝试的事情:

  • sudo apt-get update && sudo apt-get upgrade
  • sudo apt-get clean
  • sudo apt-get autoclean
  • sudo apt-get autoremove
  • sudo apt-get purge openjdk*
  • sudo apt-get purge icedtea-* openjdk-*
  • sudo apt-get install -f

  • 我从软件中删除了webupd8team&更新设置

  • 我删除了var / cache / apt / archives
  • 我删除了整个oracle-jdk8-installer文件夹及其内容

有没有办法更改wget设置并进行此安装?

1 个答案:

答案 0 :(得分:4)

这里的问题是Oracle决定在每次发布新版本时完全删除旧版本以供下载。因此,他们今天发布了 162 版本,并删除了web8upd存储库使用的 151 。目前,在web8upd存储库的维护者更改版本之前,您可以使用此修复程序(hack):

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.*

此处所有积分:https://ubuntuforums.org/showthread.php?t=2374686&page=4&p=13731177#post13731177

正如笔记一样,当他们更新到151版本并且将来会继续发生时也会发生这种情况......