我试图安装 openJDK 8,但是当我运行命令时
$ sudo apt-get install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state
information... Done
E: Unable to locate package openjdk-8-jdk
我搜索了互联网,发现有人建议运行以下2个命令:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
以下是我得到的结果:
$sudo add-apt-repository ppa:webupd8team/java
Oracle Java (JDK) Installer (automatically downloads and installs Oracle > JDK7 / JDK8 / JDK9). There are no actual Java files in this PPA.
...
gpg: keyring `/tmp/tmpeqhvs8pe/secring.gpg' created
gpg: keyring `/tmp/tmpeqhvs8pe/pubring.gpg' created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpeqhvs8pe/trustdb.gpg: trustdb created
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
$ sudo apt-get update
...
Err http:/ /ppa.launchpad.net trusty/main amd64 Packages
403 Forbidden [IP: 172.16.255.22 3129]
Get:1 https:/ /rapture-prod.corp.google.com goobuntu-puppet-addons InRelease
Err http:/ /ppa.launchpad.net trusty/main i386 Packages
403 Forbidden [IP: 172.16.255.22 3129]
...
W: GPG error: http://archive.canonical.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
W: Failed to fetch http:/ /ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/main/binary-amd64/Packages 403 Forbidden [IP: 172.16.255.22 3129]
W: Failed to fetch http:/ /ppa.launchpad.net/webupd8team/java/ubuntu/dists/trusty/main/binary-i386/Packages 403 Forbidden [IP: 172.16.255.22 3129]
E: Some index files failed to download. They have been ignored, or old ones used instead.
谁知道我该怎么办?
答案1
您链接的 ppa 适用于 Oracle 的封闭式 JDK。您可以在此处查看 PPA 的内容 -https://launchpad.net/~webupd8team/+archive/ubuntu/java
您可以像这样安装
sudo apt-get install oracle-java8-installer
目前看来 14.04 中没有内置任何 OpenJDK 8 软件包。请使用您正在运行的 Ubuntu 版本更新您的问题。我假设您运行的是 14.04,因为 14.10 及更高版本有 8。
更新 :你可以用这个 PPA 安装它 -https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
或者,如果您不想为此使用 PPA,您可以升级到 14.10。它确实在存储库中有它。