OpenJDK1.8 安装及配置(Ubuntu16.04)
问题:
近日因为Oracle Java更改了协议,导致Debian下Java源出现问题,安装时出现错误:
Package 'openjdk-8-jdk' has no installation candidate 或 E: Unable to locate package openjdk-8-jdk
解决:
改用Amazon的openjdk发行版。
Amazon Corretto 是开放 Java 开发工具包 (OpenJDK) 的免费、多平台、生产就绪型发行版。
下载:
wget https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.deb
安装:
sudo apt-get update sudo apt-get install java-common sudo dpkg --install amazon-corretto-8-x64-linux-jdk.deb
验证:
# java -version openjdk version "1.8.0_212" OpenJDK Runtime Environment Corretto-8.212.04.2 (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM Corretto-8.212.04.2 (build 25.212-b04, mixed mode)