下载,选择centos7 64位版本
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
解压
tar -zxvf jdk-8u202-linux-x64.tar.gz
移动目录
sudo mkdir /usr/local/javasudo mv ~/jdk1.8.0_202 /usr/local/java/
环境配置
vi /etc/profile
写入如下内容
export JAVA_HOME=/usr/local/java/jdk1.8.0_202
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
使之生效
source /etc/profile
验证
[root@localhost java]# java -version java version "1.8.0_202" Java(TM) SE Runtime Environment (build 1.8.0_202-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
到此,配置完成!
原文地址:https://www.cnblogs.com/sea-stream/p/10404360.html
时间: 2024-10-06 01:05:22