linux用戶覆蓋全局(自定義)變量環境
[dev_ydzj_1@localhost usr]$ cd $HOME
[dev_ydzj_1@localhost ~]$ pwd
/home/dev_ydzj_1
[dev_ydzj_1@localhost ~]$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)
www.2cto.com
在公司看到上述結果,認為linux系統全局java環境是1.6,但是看到
下面的執行結果我就疑惑了
[dev_ydzj_1@localhost ~]$ tail -3 /etc/profile
export JAVA_HOME=/opt/jdk/jdk1.5.0_15
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
找人解疑,看到下面結果,頓時有所感悟!
www.2cto.com
[dev_ydzj_1@localhost ~]$ less .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export TOMCAT_HOME=/home/dev_ydzj_1/apache-tomcat-5.5.25
export CATALINA_HOME=/home/dev_ydzj_1/apache-tomcat-5.5.25
export JAVA_HOME=/opt/jdk/jdk1.6.0_24
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$TOMCAT_HOME/bin:$CATALINA_HOME/bin:$PATH:$HOME/bin
export PATH
記錄,備忘。嘿嘿!