1.创建目录
mkdir -p /usr/local/java1.8 cd /usr/local/java1.
2.下载Java jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html # 下载 tar -zvxf jdk-8u241-linux-x64.tar.gz # 解压
3.配置环境变量
vim /etc/profile export JAVA_HOME=/usr/local/java1.8/jdk1.8.0_241 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH source /etc/profile
4.添加软连接
ln -s /usr/local/java1.8/jdk1.8.0_241/bin/java /usr/bin/java
5.查看版本
java -version