Centos7 安装openjdk
一、下载安装
1yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
二、设置环境变量
1vim /etc/profile
1export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
2export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3export PATH=$PATH:$JAVA_HOME/bin
4
三、验证
1java -version