上传JDK并解压
- 上传JDK压缩包到/usr/local目录: jdk1.8.0_144.tar.gz
解压文件:
tar -xvf jdk1.8.0_144.tar.gz
解压成功即可
配置环境变量
- 修改profile文件:vi /etc/profile
添加配置信息
export JAVA_HOME=/usr/local/jdk1.8.0_144 export JRE_HOME=/usr/local/jdk1.8.0_144/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$PATH
测试配置:java -version
[root@hadoop101 ~]# java -version java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)