Skip to content

Instantly share code, notes, and snippets.

@willis7
Created August 19, 2013 21:26
Show Gist options
  • Save willis7/6274381 to your computer and use it in GitHub Desktop.
Save willis7/6274381 to your computer and use it in GitHub Desktop.
@rem *************************************************************************
@rem This script is used to set up your environment for development.
@rem It sets the following variables:
@rem
@rem
@rem JAVA_HOME - Location of the version of Java that you want to use for development.
@rem This variable must point to the root directory of a JDK
@rem installation and will be set for you by the installer.
@rem PATH - Adds the JDK and tool directories to the system path.
@rem CLASSPATH - Adds the JDK and tool jars to the classpath.
@rem
@rem Other variables that takes are:
@rem
@rem PRE_CLASSPATH - Path style variable to be added to the beginning of the
@rem CLASSPATH
@rem POST_CLASSPATH - Path style variable to be added to the end of the
@rem CLASSPATH
@rem PRE_PATH - Path style variable to be added to the beginning of the
@rem PATH
@rem POST_PATH - Path style variable to be added to the end of the PATH
@rem
@ECHO off
TITLE Environment Setup
REM Set user-defined variables.
ECHO Clearing any currently set project-specific environment variables...
SET JAVA_HOME=
SET GRADLE_HOME=
SET GROOVY_HOME=
SET PRE_CLASSPATH=
SET POST_CLASSPATH=
SET PRE_PATH=
SET POST_PATH=
ECHO Setting project-specific environment variables...
SET TOOLS_DIR=D:\tools
SET JAVA_HOME=%TOOLS_DIR%\java\1.7.0_07
SET GRADLE_HOME=%TOOLS_DIR%\gradle\1.6
SET GROOVY_HOME=%TOOLS_DIR%\groovy\2.1.6
SET PRE_CLASSPATH=
SET POST_CLASSPATH=
SET PRE_PATH=D:\Apps\Firefox;%JAVA_HOME%\bin;%GRADLE_HOME%\bin;%GROOVY_HOME%\bin
SET POST_PATH=
REM Get PRE and POST environment
IF NOT "%PRE_CLASSPATH%" == "" SET CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%
IF NOT "%POST_CLASSPATH%" == "" SET CLASSPATH=%CLASSPATH%;%POST_CLASSPATH%
IF NOT "%PRE_PATH%" == "" SET PATH=%PRE_PATH%;%PATH%
IF NOT "%POST_PATH%" == "" SET PATH=%PATH%;%POST_PATH%
REM Check that java is where we expect it to be
:checkJava
IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
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 Your environment has not been set.
) ELSE (
ECHO The file exists
)
GOTO finish
:finish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment