我在 Unix 服务器上有一个帐户。当我在 BASH 中时,我无法让它指向我想要的 Java 版本。
Unix的版本是:
SunOS 5.10 Generic January 2005
这就是我的 .profile 中的内容:
#====================================================================
# set the environment
#====================================================================
ANT_HOME=/apps1/apache-ant-1.8.4
export ANT_HOME
# $PATH:/user1/acme21 needs to be included to make anything work
PATH=.:/usr/jdk/instances/jdk1.6.0_24:$ANT_HOME/bin:$PATH:/user1/acme21
export PATH
JAVA_HOME=/usr/jdk/instances/jdk1.6.0_24
export JAVA_HOME
CLASSPATH=.:/user1/sterus01/TestProgramsLib/mail.jar:/user1/sterus01/TestProgramsLib/activation.jar:/user1/sterus01/TestProgramsLib/log4j-1.2.16.jar:/user1/sterus01/TestProgramsLib/mail.jar:ojdbc14.jar
export CLASSPATH
env | grep DIS
# Use the bash shell, get many conveniences
bash
当我运行 echo $JAVA_HOME 和 echo $PATH 我得到
bash-3.00$ echo $JAVA_HOME
/usr/jdk/instances/jdk1.6.0_24
bash-3.00$
和
bash-3.00$ echo $PATH
.:/usr/jdk/instances/jdk1.6.0_24:/apps1/apache-ant-1.8.4/bin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/etc:/usr/ucb:/usr/local/sudo:/usr/local/sbin:/user1/acme21
bash-3.00$
然而“which javac”揭示了:
bash-3.00$ which javac
/usr/bin/javac
bash-3.00$
和“哪个java”显示:
bash-3.00$ which java
/usr/bin/java
bash-3.00$
有什么办法可以让它指向我在 .profile 文件中指定的 Java 版本吗?
提前谢谢史蒂夫节日快乐