尝试升级软件包时出现 Java 问题

尝试升级软件包时出现 Java 问题

尝试升级软件包时出现此错误:

sudo apt upgrade awesome
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... awesome is already the newest version.
The following packages were automatically installed and are no longer required:
  ant ant-optional antlr3 aspectj default-jdk-doc javahelp2 junit junit-doc junit4 junit4-doc libantlr-java
  libantlr3-runtime-java libasm3-java libaspectj-java libatinject-jsr330-api-java libbeansbinding-java libbindex-java
  libbsh-java libbytelist-java libcdi-api-java libcglib-java libcommons-beanutils-java libcommons-codec-java
  libcommons-collections3-java libcommons-compress-java libcommons-digester-java libcommons-httpclient-java
  libcommons-io-java libcommons-lang-java libcommons-net-java libcommons-net1-java libeclipselink-java
  libequinox-osgi-java libfelix-framework-java libfelix-main-java libfreemarker-java
  libgeronimo-interceptor-3.0-spec-java libgeronimo-j2ee-connector-1.5-spec-java libgeronimo-jms-1.1-spec-java
  libgeronimo-jpa-2.0-spec-java libgeronimo-jta-1.1-spec-java libgeronimo-osgi-support-java
  libgeronimo-validation-1.0-spec-java libhamcrest-java libhamcrest-java-doc libicu4j-4.4-java libini4j-java
  libjavaewah-java libjcodings-java libjcommander-java libjemmy2-java libjgit-java libjna-java libjna-jni
  libjna-platform-java libjnlp-servlet-java libjoda-convert-java libjoda-time-java libjpa-2.1-spec-java
  libjsch-agent-proxy-java libjsch-java libjson-simple-java libjsr311-api-java libjvyamlb-java libjzlib-java
  liblucene3-contrib-java liblucene3-java libmail-java libnb-absolutelayout-java libnb-apisupport3-java libnb-ide14-java
  libnb-java5-java libnb-javaparser-java libnb-org-openide-modules-java libnb-org-openide-util-java
  libnb-org-openide-util-lookup-java libnb-platform-devel-java libnb-platform18-java libntdb1 liboro-java
  libosgi-annotation-java libosgi-compendium-java libosgi-core-java libosgi-foundation-ee-java libregexp-java
  libsdo-api-java libsequence-library-java libserf-1-1 libservlet2.5-java libservlet3.1-java libsimple-validation-java
  libsqljet-java libstringtemplate-java libstringtemplate4-java libsvn-java libsvn1 libsvnclientadapter-java
  libsvnkit-java libswing-layout-java libswingx-java libtrilead-ssh2-java libws-commons-util-java libxerces2-java
  libxml-commons-external-java libxml-commons-resolver1.1-java libyaml-snake-java linux-headers-4.2.0-16
  linux-headers-4.2.0-16-generic linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic openjdk-7-doc
  python-ntdb testng
Use 'apt-get autoremove' to remove them.
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 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 (8u111+8u111arm-1~webupd8~0) ...
No /var/cache/oracle-jdk8-installer/wgetrc file found.
Creating /var/cache/oracle-jdk8-installer/wgetrc and
using default oracle-java8-installer wgetrc settings for it.
Downloading Oracle Java 8...
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 72.247.210.9, 72.247.210.27
Connecting to download.oracle.com (download.oracle.com)|72.247.210.9|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz [following]
--2017-06-01 18:37:26--  https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.39.104.192, 2a02:26f0:15:1:8b00::2d3e, 2a02:26f0:15:1:9100::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.39.104.192|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04 [following]
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04
Connecting to download.oracle.com (download.oracle.com)|72.247.210.9|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-06-01 18:37:28 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 oracle-java8-set-default:
 oracle-java8-set-default depends on oracle-java8-installer; however:
  Package oracle-java8-installer is not configured yet.

dpkg: error processing package oracle-java8-set-default (--configure):
 dependency problems - leaving unconfigured
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
 oracle-java8-set-default
E: Sub-process /usr/bin/dpkg returned an error code (1)

我在使用 Ubuntu 15.10。

答案1

输出中最相关的部分是:

Downloading Oracle Java 8...
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 72.247.210.9, 72.247.210.27
Connecting to download.oracle.com (download.oracle.com)|72.247.210.9|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz [following]
--2017-06-01 18:37:26--  https://edelivery.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.39.104.192, 2a02:26f0:15:1:8b00::2d3e, 2a02:26f0:15:1:9100::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.39.104.192|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04 [following]
--2017-06-01 18:37:26--  http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04
Connecting to download.oracle.com (download.oracle.com)|72.247.210.9|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-06-01 18:37:28 ERROR 404: Not Found.

oracle-java8-installer由于下载失败,导致安装失败http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz?AuthParam=1496335166_b886052f95ea6f92c97b905b0261ad04。反复失败,很奇怪。

在这种情况下,您可以尝试在另一台计算机上下载该文件,然后将其复制到这台计算机上的正确路径,然后重新运行apt-get install

  1. http://www.oracle.com并登录,或者如果你还没有账户,请创建一个
  2. 转到 JDK 档案并查找Java SE 开发套件 8u111http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
  3. 点击接受许可协议
  4. 点击jdk-8u111-linux-x64.tar.gz下载
  5. 在另一台计算机上复制到 /var/cache/oracle-jdk8-installer/jdk-8u111-linux-x64.tar.gz
  6. 跑步sudo apt-get install -f

这次,oracle-java8-installer应该找到已经存在的文件并从中安装,而不是尝试(并失败)下载。

相关内容