Check if apppath is available before trying to use it.

This commit is contained in:
hjp 2005-05-23 09:12:18 +00:00
parent ab1b1399da
commit e8b57a53b8
1 changed files with 67 additions and 59 deletions

44
.zjava
View File

@ -1,22 +1,29 @@
for i in /usr/java/j2sdk1.4.2_03 /usr/local/j2sdk1.4.2 /usr/local/j2sdk1.4.1 /usr/java/j2sdk1.4.0 \ # setup java environment.
#
# This file uses apppath. Since it would clobber the PATH variable if apppath
# isn't in the path, we just skip everything in this case.
if whence apppath > /dev/null
then
for i in /usr/java/j2sdk1.4.2_03 /usr/local/j2sdk1.4.2 /usr/local/j2sdk1.4.1 /usr/java/j2sdk1.4.0 \
/usr/java/jdk1.3.1_02 /usr/java/jre1.3.1_02 \ /usr/java/jdk1.3.1_02 /usr/java/jre1.3.1_02 \
/usr/local/jdk1.2.2 /usr/java1.2 /usr/local/jdk1.2 \ /usr/local/jdk1.2.2 /usr/java1.2 /usr/local/jdk1.2 \
/usr/local/jdk117_v3 /usr/local/jdk1.1.6 \ /usr/local/jdk117_v3 /usr/local/jdk1.1.6 \
/usr/local/java /usr/local/java
do do
if [ -d "$i/bin" ] if [ -d "$i/bin" ]
then then
PATH=$(apppath "$i/bin") PATH=$(apppath "$i/bin")
export JAVA_HOME=$i export JAVA_HOME=$i
break; break;
fi fi
done done
ALL_PATH=.:/usr/local/java/classes:$ORACLE_HOME/jdbc/lib/classes111.zip:/usr/java1.2/lib/tools.jar:/usr/local/jswdk-1.0.1/lib/servlet.jar:/usr/local/java/lib/Tidy.jar:/usr/local/roxen/2.1/roxen/server/java/classes/servlet.jar ALL_PATH=.:/usr/local/java/classes:$ORACLE_HOME/jdbc/lib/classes111.zip:/usr/java1.2/lib/tools.jar:/usr/local/jswdk-1.0.1/lib/servlet.jar:/usr/local/java/lib/Tidy.jar:/usr/local/roxen/2.1/roxen/server/java/classes/servlet.jar
NEW_PATH="" NEW_PATH=""
for i in ${(s/:/)ALL_PATH} for i in ${(s/:/)ALL_PATH}
do do
if test -r "$i" if test -r "$i"
then then
case "$NEW_PATH" in case "$NEW_PATH" in
@ -30,12 +37,12 @@ do
fi fi
esac esac
fi fi
done done
export CLASSPATH=$NEW_PATH export CLASSPATH=$NEW_PATH
for i in /usr/local/tomcat for i in /usr/local/tomcat
do do
if [ -d "$i" ] if [ -d "$i" ]
then then
export CATALINA_HOME="$i" export CATALINA_HOME="$i"
@ -43,24 +50,25 @@ do
PATH=$(apppath "$i/bin") PATH=$(apppath "$i/bin")
break; break;
fi fi
done done
for i in /usr/local/ant for i in /usr/local/ant
do do
if [ -d "$i" ] if [ -d "$i" ]
then then
export ANT_HOME="$i" export ANT_HOME="$i"
PATH=$(apppath "$i/bin") PATH=$(apppath "$i/bin")
break; break;
fi fi
done done
for i in /usr/local/openxchange for i in /usr/local/openxchange
do do
if [ -d "$i" ] if [ -d "$i" ]
then then
export OX_HOME="$i" export OX_HOME="$i"
PATH=$(apppath "$i/bin" "$i/sbin") PATH=$(apppath "$i/bin" "$i/sbin")
break; break;
fi fi
done done
fi