1. 修改全局的环境变量
# vi /etc/profile
export JAVA_HOME = /home/myuser/jdk1.7.0_03 export PATH = $JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
2. 修改单个用户的变量
$ vi /home/myuser/.bash_profile
export JAVA_HOME = /home/myuser/jdk1.7.0_03 export PATH = $JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar