| < Free Open Study > |
|
The script fragments presented in this chapter accomplish 90% of what needs to be done; the rest is just integration. Listing 13-1 is a complete, fully functioning version of the script fragments. This listing could be copied to a file and included in the shell environment configuration for users. (The next section describes how to actually accomplish this on each of the sample distributions.) This file is again in the sh shell syntax; check the web site at http://www.apress.com for an equivalent file in csh syntax for users of the csh and tcsh shells.
Listing 13-1: J2SDK User Environment Configuration Script
#!/bin/sh # set the JAVA_HOME to the default, unless it's already set if [[ "X"${JAVA_HOME} == "X" ]]; then JAVA_HOME=/opt/java/jdk fi # add the JDK's bin directory to the PATH PATH=${JAVA_HOME}/bin:${PATH} # set the CLASSPATH; initialize to just "." (current working directory) CLASSPATH=. for jar in /opt/java/packages/*; do if [[ "${jar}" == "/opt/java/packages/*" ]]; then break; fi CLASSPATH=${CLASSPATH}:${jar} done # also add any JARs in the user's own java packages directory if [ -d ${HOME}/java/packages ]; then for jar in ${HOME}/java/packages/*; do if [[ "${jar}" == "${HOME}/java/packages/*" ]]; then break; fi CLASSPATH=${CLASSPATH}:${jar} done fi export PATH JAVA_HOME CLASSPATH
| < Free Open Study > |
|