Java Reference
In-Depth Information
# These guys must be present in my classpath...
export CLASSPATH=/home/ian/classes/darwinsys-api.jar:
# Now a for loop, testing for .jar/.zip or [ -d ... ]
OPT_JARS="$HOME/classes $HOME/classes/*.jar
${JAVAHOME}/jre/lib/ext/*.jar
/usr/local/jars/antlr-3.2.0"
for thing in $OPT_JARS
do
if [ -f $thing ]; then //must be either a file...
CLASSPATH="$CLASSPATH:$thing"
else if [ -d $thing ]; then //or a directory
CLASSPATH="$CLASSPATH:$thing"
fi
done
CLASSPATH="$CLASSPATH:."
This builds a minimum CLASSPATH out of darwinsys-api.jar , then goes through a list of
other files and directories to check that each is present on this system (I use this script on
several machines on a network), and ends up adding a dot (.) to the end of the CLASSPATH.
WARNING
Note that, on Unix, a shell script executed normally can change environment variables
like CLASSPATH only for itself; the “parent” shell (the one running commands in your
terminal or window) is not affected. Changes that are meant to be permanent need to be
stored in your startup files ( .profile , .bashrc , or whatever you normally use).
Downloading and Using the Code Examples
Problem
You want to try out my example code and/or use my utility classes.
Search WWH ::




Custom Search