1 | #!/bin/sh
|
---|
2 | # -----------------------------------------------------------------------------
|
---|
3 | # Set CLASSPATH and Java options
|
---|
4 | #
|
---|
5 | # $Id: setclasspath.sh 14725 2007-10-23 04:07:09Z qq6 $
|
---|
6 | # -----------------------------------------------------------------------------
|
---|
7 |
|
---|
8 | # First clear out the user classpath
|
---|
9 | CLASSPATH=$CLASSPATH
|
---|
10 |
|
---|
11 | # Make sure prerequisite environment variables are set
|
---|
12 | if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
|
---|
13 | # Bugzilla 37284
|
---|
14 | if $darwin && [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" ]; then
|
---|
15 | export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home"
|
---|
16 | else
|
---|
17 | echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
|
---|
18 | echo "At least one of these environment variable is needed to run this program"
|
---|
19 | exit 1
|
---|
20 | fi
|
---|
21 | fi
|
---|
22 | if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
|
---|
23 | echo "JAVA_HOME should point to a JDK in order to run in debug mode."
|
---|
24 | exit 1
|
---|
25 | fi
|
---|
26 | if [ -z "$JRE_HOME" ]; then
|
---|
27 | JRE_HOME="$JAVA_HOME"
|
---|
28 | fi
|
---|
29 |
|
---|
30 | # If we're running under jdb, we need a full jdk.
|
---|
31 | if [ "$1" = "debug" -o "$1" = "javac" ] ; then
|
---|
32 | if [ "$os400" = "true" ]; then
|
---|
33 | if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
|
---|
34 | echo "The JAVA_HOME environment variable is not defined correctly"
|
---|
35 | echo "This environment variable is needed to run this program"
|
---|
36 | echo "NB: JAVA_HOME should point to a JDK not a JRE"
|
---|
37 | exit 1
|
---|
38 | fi
|
---|
39 | else
|
---|
40 | if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
|
---|
41 | echo "The JAVA_HOME environment variable is not defined correctly"
|
---|
42 | echo "This environment variable is needed to run this program"
|
---|
43 | echo "NB: JAVA_HOME should point to a JDK not a JRE"
|
---|
44 | exit 1
|
---|
45 | fi
|
---|
46 | fi
|
---|
47 | fi
|
---|
48 | if [ -z "$BASEDIR" ]; then
|
---|
49 | echo "The BASEDIR environment variable is not defined"
|
---|
50 | echo "This environment variable is needed to run this program"
|
---|
51 | exit 1
|
---|
52 | fi
|
---|
53 | if [ ! -x "$BASEDIR"/bin/setclasspath.sh ]; then
|
---|
54 | if $os400; then
|
---|
55 | # -x will Only work on the os400 if the files are:
|
---|
56 | # 1. owned by the user
|
---|
57 | # 2. owned by the PRIMARY group of the user
|
---|
58 | # this will not work if the user belongs in secondary groups
|
---|
59 | eval
|
---|
60 | else
|
---|
61 | echo "The BASEDIR environment variable is not defined correctly"
|
---|
62 | echo "This environment variable is needed to run this program"
|
---|
63 | exit 1
|
---|
64 | fi
|
---|
65 | fi
|
---|
66 |
|
---|
67 | # Set the default -Djava.endorsed.dirs argument
|
---|
68 | JAVA_ENDORSED_DIRS="$BASEDIR"/common/endorsed
|
---|
69 |
|
---|
70 | # Set standard CLASSPATH
|
---|
71 | if [ "$1" = "debug" -o "$1" = "javac" ] ; then
|
---|
72 | CLASSPATH="$JAVA_HOME"/lib/tools.jar:$CLASSPATH
|
---|
73 | fi
|
---|
74 |
|
---|
75 | # OSX hack to CLASSPATH
|
---|
76 | JIKESPATH=
|
---|
77 | if [ `uname -s` = "Darwin" ]; then
|
---|
78 | OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
|
---|
79 | if [ -d "$OSXHACK" ]; then
|
---|
80 | for i in "$OSXHACK"/*.jar; do
|
---|
81 | JIKESPATH="$JIKESPATH":"$i"
|
---|
82 | done
|
---|
83 | fi
|
---|
84 | fi
|
---|
85 |
|
---|
86 | # Set standard commands for invoking Java.
|
---|
87 | _RUNJAVA="$JRE_HOME"/bin/java
|
---|
88 | if [ "$os400" != "true" ]; then
|
---|
89 | _RUNJDB="$JAVA_HOME"/bin/jdb
|
---|
90 | fi
|
---|
91 | _RUNJAVAC="$JAVA_HOME"/bin/javac
|
---|