我试过这个答案对于 Ubuntu 16.10,但运行此命令后
sudo apt-get update
发生了此错误
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu yakkety Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/openjdk-r/ppa/ubuntu/dists/yakkety/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
尝试安装后
sudo apt-get install openjdk-7-jdk
发生此错误
E: Package 'openjdk-7-jdk' has no installation candidate
如何在 Ubuntu 16.10 上安装 openjdk-7?
答案1
我按照 I am Dev 的回答做了,并手动下载了其他依赖项。总共我必须从Debian 页面:
libjpeg62-turbo_1.5.1-2_amd64.deb
openjdk-7-jre-headless_7u121-2.6.8-2_amd64.deb
openjdk-7-jre_7u121-2.6.8-2_amd64.deb
openjdk-7-jdk_7u121-2.6.8-2_amd64.deb
并使用
sudo dpkg -i <deb file>
每当安装抱怨缺少依赖项时,你可以运行
sudo apt-get install -f
除非依赖项是下载的软件包之一,否则无法解决它们。在这种情况下,您只需先使用 dpkg 安装它们。
如果您已经安装了 Java 版本,则可以使用以下方式选择 OpenJDK 二进制文件
sudo update-alternatives --config java
sudo update-alternatives --config javac
答案2
从以下链接下载 .deb 文件https://packages.debian.org/experimental/amd64/openjdk-7-jdk/download选择镜像。然后输入 ccommand sudo dpkg -i openjdk-7-jdk_7u121-2.6.8-2_amd64.deb