为什么在Ubuntu 18.04上无法安装oracle-java8-installer?


1

我正在尝试oracle-java8-installer使用以下命令在Ubuntu 18.04上安装:

apt-get update
apt-get install --yes --no-install-recommends software-properties-common && add-apt-repository ppa:webupd8team/java -y  && echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
apt-get install oracle-java8-installer

突然,这开始失败了:

Downloading Oracle Java 8...
--2019-01-15 21:37:57--  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.198.4.45
Connecting to download.oracle.com (download.oracle.com)|23.198.4.45|: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 21:37:57--  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.34.18.118, 2001:4de0:2204:98::366, 2001:4de0:2204:93::366
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.34.18.118|: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=1547588398_34b19094b1b04e5117af5cb53859faab [following]
--2019-01-15 21:37:58--  http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?AuthParam=1547588398_34b19094b1b04e5117af5cb53859faab
Connecting to download.oracle.com (download.oracle.com)|23.198.4.45|: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=1547588398_34b19094b1b04e5117af5cb53859faab [following]
--2019-01-15 21:37:58--  https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz?AuthParam=1547588398_34b19094b1b04e5117af5cb53859faab
Connecting to download.oracle.com (download.oracle.com)|23.198.4.45|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-01-15 21:38:00 ERROR 404: Not Found.

最近删除或移动了此文件吗?


“此文件最近被删除或移动过吗?” -它很可能不存在;您收到404错误。您可以通过浏览器将tar.gz下载到另一台计算机上吗?
Ramhound


我几乎可以保证,Oracle仅归档了Java 8 u191。Java 8当前更新为201。链接问题就是这种情况,因为您的使用尝试http://download.oracle.com/otn-pub已在不久前退出
Ramhound

是的,我也同意这也是发生的事情
davidvandebunte

Answers:


0

我们可以手动下载Java并轻松安装它。

下载Java 8版本: jdk-8u212-linux-x64.tar.gz

安装步骤:

  sudo mkdir /usr/local/java

  sudo tar xvzf jdk-8u212-linux-x64.tar.gz

  sudo mv jdk1.8.0_212 /usr/local/java/

  sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_212/bin/javac" 1

  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_212/bin/java" 1

  sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_212/bin/javaws" 1

  sudo chmod a+x /usr/bin/java
  sudo chmod a+x /usr/bin/javac
  sudo chmod a+x /usr/bin/javaws
  sudo chown -R root:root /usr/local/java/jdk1.8.0_212
  sudo update-alternatives --config java

安装成功后,请检查版本。

sudo java -version
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.