安装JDK
2.1上传jdk
rz jdk-8u65-linux-x64.tar.gz
2.2解压jdk
tar -zxvf jdk-8u65-linux-x64.tar.gz -C /root/apps
2.3将java添加到环境变量中
vim /etc/profile
#在文件最后添加
export JAVA_HOME=/root/apps/jdk1.8.0_65
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
#刷新配置
source /etc/profile
注意jdk1.8 安装有点一样
windows环境环境变量配置
CLASSPATH: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar
JAVA_HOME: C:\Program Files\Java\jdk1.8.0_161
linux 环境环境变量配置
JAVA_HOME=/usr/java1.8/jdk1.8.0_161
HADOOP_HOME=/home/chinahadoop/hadoop/ha/hadoop-2.7.4
ZOOKEEPER_HOME=/home/chinahadoop/hadoop/zookeeper/zookeeper-3.4.12
export PATH=$PATH:$JAVA_HOME/bin:${ZOOKEEPER_HOME}/bin
#:${ZOOKEEPER_HOME}/conf
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar