1、下载jdk11版本,上传解压到用户目录/home/javaeleven
su javaeleven 切换到该用户下
2、
[javaeleven@bogon home]$ vim /home/javaeleven/.bashrc
3、末尾添加
export JAVA_HOME=/home/javaeleven/jdk-11.0.13
export JAVA_BIN=$JAVA_HOME/bin
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
4、保存退出编辑
5、[javaeleven@bogon home]$ source .bashrc
6、校验
[javaeleven@bogon home]$ java -version
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)
切换用户
[jiqiu@bogon home]$ java -version
java version "1.8.0_311"
Java(TM) SE Runtime Environment (build 1.8.0_311-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode)