https://www.fosstechnix.com/install-oracle-java-8-on-ubuntu-20-04/
sudo mkdir -p /opt/jdk
# 解压后放到/opt/jdk
- Install Oracle Java 8 on Ubuntu 20.04 LTS with Alternatives
sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_251/bin/java 100
- 如果有多个版本可以这么切换
sudo update-alternatives --config java
- 配置环境变量
# 编辑 /etc/environment ,填入以下内容
JAVA_HOME=/opt/jdk/jdk1.8.0_251
JRE_HOME=/opt/jdk/jdk1.8.0_251/jre
# 使生效
source /etc/environment
网友评论