2976N/Arem The contents of this file are subject to the terms of the
2976N/Arem Common Development and Distribution License, Version 1.0 only
2976N/Arem (the "License"). You may not use this file except in compliance
2976N/Arem You can obtain a copy of the license at
2976N/Arem See the License for the specific language governing permissions
2976N/Arem and limitations under the License.
2976N/Arem When distributing Covered Code, include this CDDL HEADER in each
2976N/Arem file and include the License file at
2976N/Arem add the following below this CDDL HEADER, with the fields enclosed
2976N/Arem by brackets "[]" replaced with your own identifying information:
2976N/Arem Portions Copyright [yyyy] [name of copyright owner]
5022N/Arem Copyright 2008-2010 Sun Microsystems, Inc.
6238N/Arem Portions Copyright 2011-2013 ForgeRock AS
2976N/Aset SET_JAVA_HOME_AND_ARGS_DONE=false
2976N/Aset SET_ENVIRONMENT_VARS_DONE=false
2976N/Aset SET_CLASSPATH_DONE=false
3824N/Aif "%INSTALL_ROOT%" == "" goto setInstanceRoot
2976N/Aif "%SCRIPT_UTIL_CMD%" == "set-full-environment-and-test-java" goto setFullEnvironmentAndTestJava
2976N/Aif "%SCRIPT_UTIL_CMD%" == "set-full-environment" goto setFullEnvironment
2976N/Aif "%SCRIPT_UTIL_CMD%" == "set-java-home-and-args" goto setJavaHomeAndArgs
2976N/Aif "%SCRIPT_UTIL_CMD%" == "set_environment_vars" goto setEnvironmentVars
2976N/Aif "%SCRIPT_UTIL_CMD%" == "test-java" goto testJava
2976N/Aif "%SCRIPT_UTIL_CMD%" == "set-classpath" goto setClassPath
2976N/Afor %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
6238N/Aif "%SET_CLASSPATH_DONE%" == "true" goto end
6251N/Arem get the absolute paths before building the classpath
6251N/Arem it also helps comparing the two paths
6251N/AFOR /F %%i IN ("%INSTALL_ROOT%") DO set INSTALL_ROOT=%%~dpnxi
6251N/AFOR /F %%i IN ("%INSTANCE_ROOT%") DO set INSTANCE_ROOT=%%~dpnxi
4287N/AFOR %%x in ("%INSTALL_ROOT%\resources\*.jar") DO call "%INSTALL_ROOT%\lib\
setcp.bat" %%x
3824N/Aset CLASSPATH=%INSTANCE_ROOT%\classes;%CLASSPATH%
6251N/Aif "%INSTALL_ROOT%" == "%INSTANCE_ROOT%" goto setClassPathDone
6251N/AFOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\
setcp.bat" %%x
2976N/Aif "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs
2976N/Aif "%SET_CLASSPATH_DONE%" == "false" goto setClassPath
2976N/Aif "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars
2976N/A:setFullEnvironmentAndTestJava
2976N/Aif "%SET_JAVA_HOME_AND_ARGS_DONE%" == "false" goto setJavaHomeAndArgs
2976N/Aif "%SET_CLASSPATH_DONE%" == "false" goto setClassPath
2976N/Aif "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars
6238N/Aif "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto end
5636N/Aif "%OPENDJ_JAVA_BIN%" == "" goto checkEnvJavaHome
2976N/Aset SET_JAVA_HOME_AND_ARGS_DONE=true
5636N/Aif "%OPENDJ_JAVA_BIN%" == "" goto checkEnvLegacyJavaHome
5636N/Aif not exist "%OPENDJ_JAVA_BIN%" goto checkEnvLegacyJavaHome
5636N/Aif "%OPENDS_JAVA_BIN%" == "" goto checkOpenDJJavaHome
5636N/Aif not exist "%OPENDS_JAVA_BIN%" goto checkOpenDJJavaHome
5636N/Aset OPENDJ_JAVA_BIN=%OPENDS_JAVA_BIN%
5636N/Aif "%OPENDJ_JAVA_HOME%" == "" goto checkLegacyOpenDSJavaHome
5636N/Aif not exist "%OPENDJ_JAVA_HOME%\bin\
java.exe" goto checkLegacyOpenDSJavaHome
4915N/Aif "%OPENDS_JAVA_HOME%" == "" goto checkJavaPath
4915N/Aif not %errorlevel% == 0 goto checkJavaBin
2976N/Aif "%JAVA_BIN%" == "" goto checkJavaHome
2976N/Aif not exist "%JAVA_BIN%" goto checkJavaHome
5636N/Aset OPENDJ_JAVA_BIN=%JAVA_BIN%
4915N/Aif "%JAVA_HOME%" == "" goto noJavaFound
4261N/Aecho ERROR: Could not find a valid Java binary to be used.
5224N/Aecho You must specify the path to a valid Java 6.0 update 10 or higher version.
2976N/Aecho The procedure to follow is:
5636N/Aecho 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid
4261N/Aecho If you want to have specific Java settings for each command line you must
2976N/Aecho follow the steps 3 and 4.
4261N/Aecho 3. Edit the properties file specifying the Java binary and the Java arguments
4261N/Aecho for each command line. The Java properties file is located in:
6238N/Aif %SET_ENVIRONMENT_VARS_DONE% == "true" goto end
3007N/Aset PATH=%SystemRoot%;%PATH%
2976N/Aset SET_ENVIRONMENT_VARS_DONE=true
5636N/Aif "%OPENDJ_JAVA_ARGS%" == "" goto checkLegacyArgs
3449N/Aset RESULT_CODE=%errorlevel%
3449N/Aif %RESULT_CODE% == 13 goto notSupportedJavaHome
3449N/Aif not %RESULT_CODE% == 0 goto noValidJavaHome
5636N/Aif "%OPENDS_JAVA_ARGS%" == "" goto continueTestJava
5636N/Aset OPENDJ_JAVA_ARGS=%OPENDS_JAVA_ARGS%
5636N/Aif NOT "%OPENDJ_JAVA_ARGS%" == "" goto noValidHomeWithArgs
2976N/Aecho ERROR: The detected Java version could not be used. The detected
5224N/Aecho You must specify the path to a valid Java 6.0 update 10 or higher version.
2976N/Aecho The procedure to follow is:
5636N/Aecho 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid
4261N/Aecho If you want to have specific Java settings for each command line you must
2976N/Aecho follow the steps 3 and 4.
4261N/Aecho 3. Edit the properties file specifying the Java binary and the Java arguments
4261N/Aecho for each command line. The Java properties file is located in:
5218N/Arem We get here when the java version is 6 (or up) but not supported. We run
3449N/Arem InstallDS again to see a localized message.
4261N/Aecho ERROR: The detected Java version could not be used with the set of Java
5636N/Aecho arguments %OPENDJ_JAVA_ARGS%.
4261N/Aecho The detected Java binary is:
5224N/Aecho You must specify the path to a valid Java 6.0 update 10 or higher version.
2976N/Aecho The procedure to follow is:
5636N/Aecho 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid
4261N/Aecho If you want to have specific Java settings for each command line you must
2976N/Aecho follow the steps 3 and 4.
4261N/Aecho 3. Edit the properties file specifying the Java binary and the Java arguments
4261N/Aecho for each command line. The Java properties file is located in: