home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 March B
/
SCO_CASTOR4RRT.iso
/
jdk113
/
root
/
opt
/
jdk-1.1.3
/
bin
/
javadoc
< prev
next >
Wrap
Text File
|
1998-08-19
|
3KB
|
106 lines
#!/bin/sh
#
# @(#)java_wrapper.sh 1.29 97/05/14
#
#===================================================================
# THIS SCRIPT AND JAVA WILL NOT RUN UNDER SUNOS4.X, AKA SOLARIS 1.X.
#===================================================================
# set -o trackall
# Set up default variable values if not supplied by the user.
PRG=`type $0 | cut -f3 -d' '` >/dev/null 2>&1
J_HOME=`dirname $PRG`/..
progname=`basename $0`
# The default THREADS_TYPE is "green_threads". To change the default change
# the setting of the DEFAULT_THREADS_FLAG variable. The only valid values
# of that variable are 'green' and 'native'.
#
# This introduces a dependency of this wrapper on the policy used to do builds.
# e.g. the usage of the name "green_threads" here is dependent on the build
# scripts which use the same name. Since this is somewhat analogous to the
# wrapper already depending on the build scripts putting the executable in
# a specific place (JAVA_HOME/bin/`uname -p`), the new dependency does not
# seem all that bad.
DEFAULT_THREADS_FLAG=green
if [ "${THREADS_FLAG:-${DEFAULT_THREADS_FLAG}}" = "native" ] ; then
THREADS_TYPE=native_threads
else
THREADS_TYPE=green_threads
fi
export THREADS_TYPE
#echo "Using executables built for $THREADS_TYPE"
#
# If the -noenv argument is specified, we set JAVA_HOME
# and CLASSPATH to nothing, effectively ignoring those
# environment variables.
#
# If one of java's '-*' options was specified on the command line,
# then ksh insists on trying to interpret the option when
# we do a set. Worse, it swallows the option, refusing
# to pass it on to (binary) java. So we keep track of
# all options and pass them on to eval by hand.
#
# Search for '-native' or '-green' flags, and remove them from the
# arguments if found. Also if found, set THREADS_TYPE to either
# 'native_threads' or 'green_threads', as appropriate. This is an
# alternative to using the THREADS_FLAG environment variable to
# specify the threads package for Solaris.
# On the off chance someone wants to pass -green or -native to
# a java program, we stop searching on the first arg that doesn't
# start with a runtime-option-specifying hyphen, '-'.
#
DEBUGVM=
for a in "$@"; do
case $a in
-native)
THREADS_TYPE=native_threads
;;
-green)
THREADS_TYPE=green_threads
;;
-debug)
DEBUGVM="_g"
echo "Using debug version of JVM"
;;
-*) ;;
*) ;; #break;
esac
done
if [ -z "$JAVA_HOME" ] ; then
export JAVA_HOME
JAVA_HOME=$J_HOME
fi
CLASSPATH="${CLASSPATH-.}"
if [ -z "${CLASSPATH}" ] ; then
CLASSPATH="$JAVA_HOME/classes:$JAVA_HOME/lib/classes.jar:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:$JAVA_HOME/lib/classes.zip"
else
CLASSPATH="$CLASSPATH:$JAVA_HOME/classes:$JAVA_HOME/lib/classes.jar:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:$JAVA_HOME/lib/classes.zip"
fi
export CLASSPATH
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$JAVA_HOME/lib/`uname -p`/$THREADS_TYPE"
export LD_LIBRARY_PATH
progname=`basename $0`
prog=$JAVA_HOME/bin/`uname -p`/${THREADS_TYPE}/${progname}${DEBUGVM}
if [ -f $prog ]
then
eval exec $DEBUG_PROG $prog $opts '"$@"'
else
echo >&2 "$progname was not found in ${prog}"
exit 1
fi