我正在尝试使用以下命令在我的 debian 上下载并安装 JDK 8: apt-get install oracle-java8-installer
这是我得到的日志:
[...]
Do you want to continue? [Y/n] Y
Setting up oracle-java8-installer (8u191-1~webupd8~1) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2019-01-15 23:15:16-- http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.45.100.92
Connecting to download.oracle.com (download.oracle.com)|23.45.100.92|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz [following]
--2019-01-15 23:15:16-- https://edelivery.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.43.114.123, 2a02:26f0:64:18e::366, 2a02:26f0:64:1b6::366
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.43.114.123|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?AuthParam=15475906 37_9166d63baaaf8c1cb5bbe211d579a825 [following]
--2019-01-15 23:15:16-- http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?Aut hParam=1547590637_9166d63baaaf8c1cb5bbe211d579a825
Connecting to download.oracle.com (download.oracle.com)|23.45.100.92|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?AuthParam=1547590 637_9166d63baaaf8c1cb5bbe211d579a825 [following]
--2019-01-15 23:15:16-- https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?Au thParam=1547590637_9166d63baaaf8c1cb5bbe211d579a825
Connecting to download.oracle.com (download.oracle.com)|23.45.100.92|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-01-15 23:15:16 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)
我的防火墙配置有误还是我遗漏了什么?
答案1
该包本质上是一个打包脚本,用于从 Oracle.com 下载 Java 安装程序。
它曾经在 Debian 8 和 Java 8 的鼎盛时期工作 - 它不再工作,因为特定的 Java 8 安装文件不再位于该位置。
世界已经简单地继续前进 - 同样从错误中,404 未找到表示存在通信,并且与阻塞的端口/防火墙没有任何关系。对方正在回答,只是说“404 - Not Found”。
我建议使用另一种方法来安装 Java 框架。对于大多数项目来说,替代方案openjdk
已经足够了,并且可以轻松安装:
sudo apt-get install openjdk-8-jdk
答案2
Oracle JDK 8 公共更新结束
2019 年 1 月之后,Oracle 将不会在其公共下载网站上发布 Java SE 8 的进一步更新以用于商业用途。需要持续访问关键错误修复和安全修复以及 Java SE 8 或之前版本的一般维护的客户可以获得长期服务通过 Oracle Java SE 订阅或 Oracle Java SE 桌面订阅提供支持。有关更多信息以及有关如何获得 Oracle JDK 8 长期支持的详细信息,请参阅 Oracle Java SE 支持路线图。
复制自: https://www.oracle.com/technetwork/java/javase/overview/index.html
因此,您可以安装 Oracle JDK 11 也可以手动安装 Oracle JDK 8
https://www.vultr.com/docs/how-to-manually-install-java-8-on-ubuntu-16-04