1.设置用户环境变量vi .bash_profile 或者是 vi ~/.bashrc
2.JAVA_HOME=/home/sgmm/jdk1.6.0_13
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME
3.设置tomcat的环境变量export CATALINA_BASE=/home/sgmm/apache-tomcat-6.0.20
export CATALINA_HOME=/home/sgmm/apache-tomcat-6.0.20
4.使环境变量生效source ~/.bash_profile