vim /etc/profile #set jdk env export JAVA_HOME=/opt/jdk8 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib export PATH=${JAVA_HOME}/bin:$PATH
最后刷新profile 使之生效 source /etc/profile