1.下载jdk8
方法一:官网手动下载
下载Linux环境下的jdk1.8
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.解压
tar -zxvf jdk-8u291-linux-x64.tar.gz
3.配置jdk环境变量
vim /etc/profile
export JAVA_HOME=/project/my_config/jdk/jdk1.8.0_291 #jdk安装目录
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
然后:esc 退出编辑
:wq 保存
4.配置生效
source /etc/profile
5.测试
java -version