centos7.9安装jdk
1.下载jdk
yum install java-1.8.0-openjdk
cd /usr/lib/jvm
ls
mv java-1.8.0-openjdk-1.8.0.412.b08-1.el7_9.x86_64 java8
2.配置环境变量
nano /etc/profile
在末尾添加:
export JAVA_HOME=/usr/lib/jvm/java8/jre
export CLASSPATH=$:CLASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
3.测试安装完成
java -version