centos7安装jdk1.8

创建文件夹java后,解压:
tar -zxvf jdk-8u181-linux-x64.tar.gz
配置环境变量:
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib

切换java版本:
sudo alternatives --install /uar/bin/java java /usr/java/jdk1.8.0_181/bin/java 100
sudo alternatives --install /uar/bin/javac javac /usr/java/jdk1.8.0_181/bin/javac 100

sudo alternatives --config java
sudo alternatives --config javac

参考博客:https://blog.csdn.net/dhr201499/article/details/81626466

posted on 2020-11-03 16:18  渐行渐远的那些人  阅读(65)  评论(0编辑  收藏  举报