一、免登陆全局ssh
vim ~/.bashrc
export JAVA_HOME=/usr/local/src/jdk1.7.0_79
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
二、登陆
vi /etc/profile
export JAVA_HOME=/opt/jdk1.7.0_79
export JAVA_BIN=$JAVA_HOME/bin
export JAVA_LIB=$JAVA_HOME/lib
export CLASSPATH=.:$JAVA_LIB/tools.jar:$JAVA_LIB/dt.jar
export PATH=$JAVA_BIN:$PATH
source /etc/profile // 刷新