Skip to content

Instantly share code, notes, and snippets.

@willis7
Created August 19, 2013 21:31
Show Gist options
  • Save willis7/6274421 to your computer and use it in GitHub Desktop.
Save willis7/6274421 to your computer and use it in GitHub Desktop.
# *************************************************************************
# This script is used to set up your environment for development.
# It sets the following variables:
#
#
# JAVA_HOME - Location of the version of Java that you want to use for development.
# This variable must point to the root directory of a JDK
# installation and will be set for you by the installer.
# PATH - Adds the JDK and tool directories to the system path.
# CLASSPATH - Adds the JDK and tool jars to the classpath.
#
# Other variables that takes are:
#
# PRE_CLASSPATH - Path style variable to be added to the beginning of the
# CLASSPATH
# POST_CLASSPATH - Path style variable to be added to the end of the
# CLASSPATH
# PRE_PATH - Path style variable to be added to the beginning of the
# PATH
# POST_PATH - Path style variable to be added to the end of the PATH
#
#*****************************************************************************
# Set user-defined variables.
echo "Clearing any currently set project-specific environment variables..."
export JAVA_HOME=
export ANT_HOME=
export ANT_OPTS=
export PRE_CLASSPATH=
export POST_CLASSPATH=
export PRE_PATH=
export POST_PATH=
echo "Setting project-specific environment variables..."
export JAVA_HOME=u01/apps/Java/jdk1.5.0_09
export ANT_HOME=
export ANT_OPTS=
export PRE_CLASSPATH=
export POST_CLASSPATH=
export PRE_PATH=
export POST_PATH=;%JAVA_HOME%/bin
# Get PRE and POST environment
if [ ! -z "${PRE_CLASSPATH}" ]; then
CLASSPATH="${PRE_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
fi
if [ ! -z "${POST_CLASSPATH}" ]; then
CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${POST_CLASSPATH}"
fi
if [ ! -z "${PRE_PATH}" ]; then
PATH="${PRE_PATH}${PATHSEP}${PATH}"
fi
if [ ! -z "${POST_PATH}" ]; then
PATH="${PATH}${PATHSEP}${POST_PATH}"
fi
# Check that java is where we expect it to be
elif [ ! -d "${JAVA_HOME}/bin" ]; then
echo
echo "The JDK wasn't found in directory ${JAVA_HOME}."
echo "Please edit this script so that the JAVA_HOME"
echo "variable points to the location of your JDK."
echo CLASSPATH=${CLASSPATH}
echo
echo PATH=${PATH}
echo
echo "Your environment has been set."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment