CentOS7下配置Java环境

下载

1
wget https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz

解压

1
2
tar xvf OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz
mv jdk-11.0.15+10/ /home

配置

1
2
3
4
5
echo -e "\n" >> /etc/profile
echo "export JAVA_HOME=/home/jdk-11.0.15+10" >> /etc/profile
echo "export PATH=\$JAVA_HOME/bin:\$PATH" >> /etc/profile
echo "export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar" >> /etc/profile
source /etc/profile