mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
28.50.2007 69287099bab9640465cb18ef4006252d05a33e5d
Fix for issue 2035 (Use OpenDS specific environment variables to determine the JVM to be used.)

Use two environment variables to know which is the JVM to be used by the scripts: OPENDS_JAVA_BIN and OPENDS_JAVA_HOME.

When the setup creates the file lib/set-java-home it writes the contents of OPENDS_JAVA_HOME to it (instead of JAVA_HOME which was the previous behavior).

Before these changes, the scripts used to look for JAVA_BIN, then JAVA_HOME and finally for the contents of the set-java-home file. The problem with this approach is that if the user required to specify JAVA_HOME or JAVA_BIN to an unsupported version of the JDK (because some other program in the machine had this requirement) the scripts of OpenDS could not run. Now the checks that we do to figure out the JVM are done in the following order:
1. Check if OPENDS_JAVA_BIN is defined in the environment.
2. Check if OPENDS_JAVA_HOME is defined in the environment.
3. Check if OPENDS_JAVA_HOME is defined in the lib/set-java-home file.
4. Check if JAVA_BIN is defined in the environment.
5. Check if JAVA_HOME is defined in the environment.
6. Check if we can figure out the java installation by executing "type java" (in UNIX environments).

If any of the above checks is positive, we will try to use the JVM found.

Extras: the uninstall script on UNIX now checks that we are using a JDK compatible with 1.5 and displays a user friendly message if it does not.


25 files modified
938 ■■■■■ changed files
opends/resource/bin/_client-script.bat 38 ●●●●● patch | view | raw | blame | history
opends/resource/bin/_client-script.sh 37 ●●●●● patch | view | raw | blame | history
opends/resource/bin/_server-script.bat 38 ●●●●● patch | view | raw | blame | history
opends/resource/bin/_server-script.sh 36 ●●●●● patch | view | raw | blame | history
opends/resource/bin/start-ds 58 ●●●●● patch | view | raw | blame | history
opends/resource/bin/start-ds.bat 59 ●●●●● patch | view | raw | blame | history
opends/resource/bin/status-panel.bat 52 ●●●● patch | view | raw | blame | history
opends/resource/bin/stop-ds 46 ●●●●● patch | view | raw | blame | history
opends/resource/bin/stop-ds.bat 51 ●●●●● patch | view | raw | blame | history
opends/resource/setup 77 ●●●●● patch | view | raw | blame | history
opends/resource/setup.bat 61 ●●●●● patch | view | raw | blame | history
opends/resource/uninstall 118 ●●●●● patch | view | raw | blame | history
opends/resource/uninstall.bat 42 ●●●●● patch | view | raw | blame | history
opends/resource/upgrade 85 ●●●●● patch | view | raw | blame | history
opends/resource/upgrade.bat 46 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java 14 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java 7 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java 8 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java 8 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java 13 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/CreateRCScript.java 9 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/SetupUtils.java 23 ●●●●● patch | view | raw | blame | history
opends/resource/bin/_client-script.bat
@@ -33,31 +33,43 @@
set INSTANCE_ROOT=%DIR_HOME%
if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
goto checkJavaBin
goto checkOpenDSJavaBin
:noInvokeClass
echo Error:  OPENDS_INVOKE_CLASS environment variable is not set.
pause
goto end
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -67,7 +79,7 @@
set PATH=%SystemRoot%
"%JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% %*
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% %*
:end
opends/resource/bin/_client-script.sh
@@ -50,33 +50,44 @@
cd "${WORKING_DIR}"
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
            export OPENDS_JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
  fi
fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
@@ -100,4 +111,4 @@
export CLASSPATH
# Launch the appropriate server utility.
"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" "${@}"
"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" "${@}"
opends/resource/bin/_server-script.bat
@@ -33,31 +33,43 @@
set INSTANCE_ROOT=%DIR_HOME%
if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
goto checkJavaBin
goto checkOpenDSJavaBin
:noInvokeClass
echo Error:  OPENDS_INVOKE_CLASS environment variable is not set.
pause
goto end
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -67,7 +79,7 @@
set PATH=%SystemRoot%
"%JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
:end
opends/resource/bin/_server-script.sh
@@ -50,30 +50,42 @@
cd "${WORKING_DIR}"
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
            export OPENDS_JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
@@ -100,6 +112,6 @@
export CLASSPATH
# Launch the appropriate server utility.
"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
     --configClass org.opends.server.extensions.ConfigFileHandler \
     --configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}"
opends/resource/bin/start-ds
@@ -41,32 +41,42 @@
cd "${WORKING_DIR}"
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
            export OPENDS_JAVA_BIN
      else
        echo "ERROR:  No Java installation could be found.  Please set"
        echo "        JAVA_HOME to the root of a Java 5.0 or higher"
        echo "        installation."
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
@@ -108,21 +118,21 @@
# Test that the provided JDK is 1.5 compatible.
if test -z "${JAVA_ARGS}"
then
  "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used.  Please ensure"
    echo "        that JAVA_HOME is set to the root of a valid Java 5.0 or"
    echo "        that OPENDS_JAVA_HOME is set to the root of a valid Java 5.0 or"
    echo "        higher installation."
    exit 1
  fi
else
  "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used with the"
    echo "        set of arguments.  Please ensure that JAVA_HOME is set to"
    echo "        the root of a valid Java 5.0 or higher installation, and"
    echo "        set of arguments.  Please ensure that OPENDS_JAVA_HOME is"
    echo "        set to the root of a valid Java 5.0 or higher installation, and"
    echo "        make sure that JAVA_ARGS contains a valid set of arguments"
    echo "        for that JVM."
    exit 1
@@ -135,7 +145,7 @@
# means that the server is already running and we shouldn't try to start it.
# An exit code of anything else means that we're not trying to start the server
# and we can just exit with that exit code.
${JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
            --configClass org.opends.server.extensions.ConfigFileHandler \
            --configFile "${CONFIG_FILE}" --checkStartability "${@}"
EC=${?}
@@ -145,24 +155,24 @@
  # run detach
  #
  touch "${STARTING_FILE}"
  nohup "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
  nohup "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
       org.opends.server.core.DirectoryServer \
       --configClass org.opends.server.extensions.ConfigFileHandler \
       --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
  echo $! > "${PID_FILE}"
  if test ${EC} -eq 99
  then
    "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
    "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
         --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"
  else
    "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
    "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
         --targetFile "${STARTING_FILE}"
  fi
  EC=${?}
  if test ${EC} -eq 0
  then
    # An exit code of 98 means that the server is already running.
    ${JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
    ${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
            --configClass org.opends.server.extensions.ConfigFileHandler \
            --configFile "${CONFIG_FILE}" --checkStartability > /dev/null 2>&1
    EC=${?}
@@ -183,7 +193,7 @@
    #
    echo $$ > "${PID_FILE}"
    rm -f "${LOG_FILE}"
    exec "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
    exec "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
      org.opends.server.core.DirectoryServer \
      --configClass org.opends.server.extensions.ConfigFileHandler \
      --configFile "${CONFIG_FILE}" "${@}"
opends/resource/bin/start-ds.bat
@@ -36,33 +36,44 @@
echo %SCRIPT%: invoked >> %LOG%
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo %SCRIPT%: JAVA_HOME environment variable is not set. >> %LOG%
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo %SCRIPT%: The detected Java version could notf be used. JAVA_HOME=[%JAVA_HOME%] >> %LOG%
echo %SCRIPT%: The detected Java version could not be used. OPENDS_JAVA_HOME=[%OPENDS_JAVA_HOME%] >> %LOG%
echo ERROR:  The detected Java version could not be used.  Please set 
echo         JAVA_HOME to to a valid Java 5 (or later) installation.
echo         OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -78,10 +89,10 @@
set SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=start-ds
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability %*
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability %*
if %errorlevel% == 98 goto serverAlreadyStarted
if %errorlevel% == 99 goto runDetach
@@ -98,7 +109,7 @@
echo %SCRIPT%: Run no detach  >> %LOG%
if not exist "%DIR_HOME%\logs\server.out" echo. > "%DIR_HOME%\logs\server.out"
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
"%JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
goto end
@@ -106,9 +117,9 @@
echo %SCRIPT%: Run detach  >> %LOG%
if not exist "%DIR_HOME%\logs\server.out" echo. > "%DIR_HOME%\logs\server.out"
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%JAVA_BIN%" %JAVA_ARGS%  org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" %JAVA_ARGS%  org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
goto checkStarted
:runDetachCalledByWinService
@@ -118,24 +129,24 @@
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
echo. > "%DIR_HOME%\logs\server.startingservice"
echo. > "%DIR_HOME%\logs\winservice.out"
"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%JAVA_BIN%" -Xrs %JAVA_ARGS%  org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" -Xrs %JAVA_ARGS%  org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
erase "%DIR_HOME%\logs\server.startingservice"
goto checkStarted
:runAsService
echo %SCRIPT%: Run as service >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.startingservice" to be deleted >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
rem Type the contents the winwervice.out file and delete it.
if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
goto end
:checkStarted
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability > NUL 2>&1
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability > NUL 2>&1
if %errorlevel% == 98 goto serverStarted
goto serverNotStarted
opends/resource/bin/status-panel.bat
@@ -30,25 +30,37 @@
set INSTANCE_ROOT=%DIR_HOME%
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 installation.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -57,8 +69,22 @@
set PATH=%SystemRoot%
"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS%  org.opends.guitools.statuspanel.StatusPanelLauncher %*
if "%~1" == "" goto callLaunch
goto callJava
:callLaunch
"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.statuspanel.StatusPanelLauncher
goto end
:callJava
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.statuspanel.StatusPanelLauncher %*
rem return part
if %errorlevel% == 50 goto version
goto end
:version
rem version information was requested. Return code should be 0.
exit /B 0
:end
opends/resource/bin/stop-ds
@@ -50,30 +50,42 @@
cd "${WORKING_DIR}"
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
            export OPENDS_JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
@@ -107,7 +119,7 @@
# Test that the provided JDK is 1.5 compatible.
if test -z "${JAVA_ARGS}"
then
  "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used.  Please set "
@@ -115,16 +127,16 @@
    exit 1
  fi
else
  "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used with the specified"
    echo "Java arguments.  Please set  JAVA_HOME to the root of a Java 5.0 installation."
    echo "Java arguments.  Please set  OPENDS_JAVA_HOME to the root of a Java 5.0 installation."
    exit 1
  fi
fi
"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
  org.opends.server.tools.StopDS --checkStoppability "${@}"
EC=${?}
@@ -189,7 +201,7 @@
    EXIT_CODE=${?}
    if test ${EXIT_CODE} -eq 0
    then
      "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
      "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
        --targetFile "${INSTANCE_ROOT}/logs/server.pid" \
        --logFile "${INSTANCE_ROOT}/logs/errors"
      EXIT_CODE=${?}
@@ -244,5 +256,5 @@
fi
# If we've gotten here, then we should try to stop the server over LDAP.
"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
  org.opends.server.tools.StopDS "${@}"
opends/resource/bin/stop-ds.bat
@@ -42,33 +42,44 @@
rem echo %SCRIPT%: your-message-here >> %LOG%
echo %SCRIPT%: invoked >> %LOG%
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
echo %SCRIPT%: JAVA_HOME environment variable is not set. >> %LOG%
pause
goto end
:noValidJavaHome
echo %SCRIPT%: The detected Java version could not be used. JAVA_HOME=[%JAVA_HOME%] >> %LOG%
echo %SCRIPT%: The detected Java version could not be used. OPENDS_JAVA_HOME=[%OPENDS_JAVA_HOME%] >> %LOG%
echo ERROR:  The detected Java version could not be used.  Please set 
echo         JAVA_HOME to to a valid Java 5 (or later) installation.
echo         OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -78,10 +89,10 @@
echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
"%JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG%  org.opends.server.tools.StopDS --checkStoppability %*
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG%  org.opends.server.tools.StopDS --checkStoppability %*
if %errorlevel% == 98 goto serverAlreadyStopped
if %errorlevel% == 99 goto startUsingSystemCall
@@ -121,16 +132,16 @@
:stopAsWindowsService
echo %SCRIPT%: stop as windows service >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
goto end
:restartAsWindowsService
echo %SCRIPT%: restart as windows service, stopping >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
if not %errorlevel% == 0 goto end
echo %SCRIPT%: restart as windows service, starting >> %LOG%
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
rem Type the contents the winwervice.out file and delete it.
if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
opends/resource/setup
@@ -26,30 +26,55 @@
#      Portions Copyright 2006-2007 Sun Microsystems, Inc.
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
# Capture the current working directory so that we can change to it later.
# Then capture the location of this script and the Directory Server instance
# root so that we can use them to create appropriate paths.
WORKING_DIR=`pwd`
cd `dirname "${0}"`
SCRIPT_DIR=`pwd`
INSTANCE_ROOT=${SCRIPT_DIR}
export INSTANCE_ROOT
cd "${WORKING_DIR}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
if test -z "${JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/bin/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
            export OPENDS_JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5  (or later) installation."
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
@@ -67,20 +92,6 @@
       LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
# Capture the current working directory so that we can change to it later.
# Then capture the location of this script and the Directory Server instance
# root so that we can use them to create appropriate paths.
WORKING_DIR=`pwd`
cd `dirname "${0}"`
SCRIPT_DIR=`pwd`
INSTANCE_ROOT=${SCRIPT_DIR}
export INSTANCE_ROOT
cd "${WORKING_DIR}"
# Configure the appropriate CLASSPATH.
CLASSPATH=${INSTANCE_ROOT}/classes
for JAR in ${INSTANCE_ROOT}/lib/*.jar
@@ -93,32 +104,32 @@
# Determine whether the detected Java environment is acceptable for use.
if test -z "${JAVA_ARGS}"
then
  "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -eq 0
  then
    JAVA_ARGS="-client"
  else
    "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    if test ${?} -ne 0
    then
      echo "ERROR:  The detected Java version could not be used.  Please set "
      echo "        JAVA_HOME to the root of a Java 5 (or later) installation."
      echo "        OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
else
  "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used.  Please set "
    echo "        JAVA_HOME to the root of a Java 5 (or later) installation."
    echo "        OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
    exit 1
  fi
fi
# Launch the setup process.
"${JAVA_BIN}" -Dorg.opends.server.scriptName=setup org.opends.quicksetup.installer.SetupLauncher "${@}"
"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=setup org.opends.quicksetup.installer.SetupLauncher "${@}"
# return part
RETURN_CODE=$?
opends/resource/setup.bat
@@ -39,38 +39,49 @@
set INSTANCE_ROOT=%DIR_HOME%
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
:invalidPath
echo Error: The current path contains a %% character.  OpenDS cannot
echo        be installed on a path containing this character.
pause
goto end
:noJavaBin
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo ERROR:  The detected Java version could not be used.  Please set 
echo         JAVA_HOME to to a valid Java 5 (or later) installation.
echo         OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -81,18 +92,18 @@
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%~1" == "" goto callLaunch
goto callJava
:callLaunch
"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher
"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher
goto end
:callJava
"%JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher %*
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher %*
rem return part
if %errorlevel% == 50 goto version
opends/resource/uninstall
@@ -27,11 +27,117 @@
# This script may be used to uninstall the server.
OPENDS_INVOKE_CLASS="org.opends.guitools.uninstaller.UninstallLauncher"
export OPENDS_INVOKE_CLASS
SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=uninstall"
export SCRIPT_NAME_ARG
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
PATH=/bin:/usr/bin
LD_LIBRARY_PATH=
LD_LIBRARY_PATH_32=
LD_LIBRARY_PATH_64=
LD_PRELOAD=
LD_PRELOAD_32=
LD_PRELOAD_64=
export PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
       LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
SCRIPT_DIR=`dirname "${0}"`
"${SCRIPT_DIR}/lib/_client-script.sh" "${@}"
# Capture the current working directory so that we can change to it later.
# Then capture the location of this script and the Directory Server instance
# root so that we can use them to create appropriate paths.
WORKING_DIR=`pwd`
cd `dirname "${0}"`
SCRIPT_DIR=`pwd`
INSTANCE_ROOT=${SCRIPT_DIR}
export INSTANCE_ROOT
cd "${WORKING_DIR}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
          if test ${?} -eq 0
          then
            export OPENDS_JAVA_BIN
          else
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
            exit 1
          fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
        fi
      else
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
# Configure the appropriate CLASSPATH.
CLASSPATH=${INSTANCE_ROOT}/classes
for JAR in ${INSTANCE_ROOT}/lib/*.jar
do
  CLASSPATH=${CLASSPATH}:${JAR}
done
export CLASSPATH
# Determine whether the detected Java environment is acceptable for use.
if test -z "${JAVA_ARGS}"
then
  "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -eq 0
  then
    JAVA_ARGS="-client"
  else
    "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    if test ${?} -ne 0
    then
      echo "ERROR:  The detected Java version could not be used.  Please set "
      echo "        OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
else
  "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used.  Please set "
    echo "        OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
    exit 1
  fi
fi
# Launch the uninstall process.
"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=uninstall org.opends.guitools.uninstaller.UninstallLauncher "${@}"
# return part
RETURN_CODE=$?
if test ${RETURN_CODE} -eq 50
then
  # Version info was on requested
  exit 0
else
  exit ${RETURN_CODE}
fi
opends/resource/uninstall.bat
@@ -30,31 +30,43 @@
set INSTANCE_ROOT=%DIR_HOME%
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto setClassPath
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto setClassPath
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo ERROR:  The detected Java version could not be used.  Please set 
echo         JAVA_HOME to to a valid Java 5 (or later) installation.
echo         OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -65,19 +77,19 @@
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%~1" == "" goto callLaunch
goto callJava
:callLaunch
"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher
"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher
goto end
:callJava
set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=uninstall"
"%JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher %*
"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher %*
rem return part
if %errorlevel% == 50 goto version
opends/resource/upgrade
@@ -25,36 +25,6 @@
#
#      Portions Copyright 2006-2007 Sun Microsystems, Inc.
# See if JAVA_HOME is set.  If not, then see if there is a java executable in
# the path and try to figure it out.
if test -z "${JAVA_BIN}"
then
  if test -z "${JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      JAVA_BIN="${JAVA_HOME}/bin/java"
      export JAVA_BIN
    else
      JAVA_BIN=`which java 2> /dev/null`
      if test ${?} -eq 0
      then
        export JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
    fi
  else
    JAVA_BIN="${JAVA_HOME}/bin/java"
    export JAVA_BIN
    export JAVA_WS
  fi
fi
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
PATH=/bin:/usr/bin
@@ -81,6 +51,45 @@
cd "${WORKING_DIR}"
# See if the environment variables are set.  If not, then see if there is a java
# executable in the path and try to figure it out.
if test -z "${OPENDS_JAVA_BIN}"
then
  if test -z "${OPENDS_JAVA_HOME}"
  then
    if test -f "${INSTANCE_ROOT}/lib/set-java-home"
    then
      . "${INSTANCE_ROOT}/lib/set-java-home"
      OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
      export OPENDS_JAVA_BIN
    else
      if test -z "${JAVA_BIN}"
      then
        if test -z "${JAVA_HOME}"
        then
          OPENDS_JAVA_BIN=`which java 2> /dev/null`
          if test ${?} -eq 0
          then
            export OPENDS_JAVA_BIN
          else
            echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
            exit 1
          fi
        else
          OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
          export OPENDS_JAVA_BIN
        fi
      else
        OPENDS_JAVA_BIN="${JAVA_BIN}"
        export OPENDS_JAVA_BIN
      fi
    fi
  else
    OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
    export OPENDS_JAVA_BIN
  fi
fi
# Configure the appropriate CLASSPATH to test.
for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
@@ -97,25 +106,25 @@
# Determine whether the detected Java environment is acceptable for use.
if test -z "${JAVA_ARGS}"
then
  "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -eq 0
  then
    JAVA_ARGS="-client"
  else
    "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    if test ${?} -ne 0
    then
      echo "ERROR:  The detected Java version could not be used.  Please set "
      echo "        JAVA_HOME to the root of a Java 5 (or later) installation."
      echo "        OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
else
  "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
  if test ${?} -ne 0
  then
    echo "ERROR:  The detected Java version could not be used.  Please set "
    echo "        JAVA_HOME to the root of a Java 5.0 installation."
    echo "        OPENDS_JAVA_HOME to the root of a Java 5.0 installation."
    exit 1
  fi
fi
@@ -142,7 +151,7 @@
# operation is a reversion.  An exit code of 50 means that the usage
# statement was printed and there is nothing else to do
"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
"${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
RETURN_CODE=$?
if test ${RETURN_CODE} -eq 99
then
@@ -155,7 +164,7 @@
    CLASSPATH=${JAR}:${CLASSPATH}
  done
  # Launch the upgrade process.
  "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
  "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
elif test ${RETURN_CODE} -eq 98
then
  # Copy jars to a temporary place from which to run the reverter
@@ -173,7 +182,7 @@
      CLASSPATH=${JAR}:${CLASSPATH}
    done
    # Launch the upgrade process.
    "${JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
    "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
  fi
elif test ${RETURN_CODE} -eq 50
then
opends/resource/upgrade.bat
@@ -32,7 +32,7 @@
:checkNewVersion
if exist "upgrade.bat.NEW" goto newVersion
goto checkJavaBin
goto checkOpenDSJavaBin
:newVersion
echo A new version of this script was made available by the last upgrade
@@ -40,38 +40,50 @@
echo to 'upgrade.bat' before continuing.
goto end
:checkJavaBin
if "%JAVA_BIN%" == "" goto noJavaBin
:checkOpenDSJavaBin
if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto callExtractor
:noJavaBin
:checkOpenDSJavaHome
if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto callExtractor
:checkOpenDSJavaHomeFile
if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
call "%DIR_HOME%\lib\set-java-home.bat"
if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
goto callExtractor
:checkJavaBin
if "%JAVA_BIN%" == "" goto checkJavaHome
set OPENDS_JAVA_BIN=%JAVA_BIN%
goto callExtractor
:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto callExtractor
:noJavaHome
if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto noSetJavaHome
call "%INSTANCE_ROOT%\lib\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto callExtractor
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo ERROR:  The detected Java version could not be used.  Please set 
echo         JAVA_HOME to to a valid Java 5 (or later) installation.
echo         OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
:callExtractor
@@ -79,7 +91,7 @@
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
set CLASSPATH=%DIR_HOME%\classes;%CLASSPATH%
"%JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
if %errorlevel% == 99 goto upgrader
if %errorlevel% == 98 goto reverter
if %errorlevel% == 50 goto version
@@ -89,7 +101,7 @@
:upgrader
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
"%JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
goto end
:reverter
@@ -97,7 +109,7 @@
xcopy "%INSTANCE_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert\lib\" /E /Q /Y
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\tmp\revert\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
"%JAVA_BIN%" org.opends.quicksetup.upgrader.ReversionLauncher %*
"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.ReversionLauncher %*
goto end
:version
opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
@@ -38,6 +38,7 @@
import javax.swing.SwingUtilities;
import org.opends.server.core.DirectoryServer;
import org.opends.server.util.SetupUtils;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.statuspanel.event.ServerStatusChangeEvent;
@@ -565,12 +566,7 @@
    argList.toArray(args);
    ProcessBuilder pb = new ProcessBuilder(args);
    Map<String, String> env = pb.environment();
    env.put("JAVA_HOME", System.getProperty("java.home"));
    /* Remove JAVA_BIN to be sure that we use the JVM running the installer
     * JVM to start the server.
     */
    env.remove("JAVA_BIN");
    env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
    try
    {
      Process process = pb.start();
@@ -683,11 +679,7 @@
    argList.toArray(args);
    ProcessBuilder pb = new ProcessBuilder(args);
    Map<String, String> env = pb.environment();
    env.put("JAVA_HOME", System.getProperty("java.home"));
    /* Remove JAVA_BIN to be sure that we use the JVM running the uninstaller
     * JVM to stop the server.
     */
    env.remove("JAVA_BIN");
    env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
    try
    {
opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -31,6 +31,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.SetupUtils;
import java.util.HashMap;
import java.util.List;
@@ -95,11 +96,7 @@
    InputStream is = null;
    try {
      Map<String, String> env = pb.environment();
      env.put("JAVA_HOME", System.getProperty("java.home"));
      /* Remove JAVA_BIN to be sure that we use the JVM running the
       * uninstaller JVM to run the command.
       */
      env.remove("JAVA_BIN");
      env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
      Process process = pb.start();
      is = process.getInputStream();
      BufferedReader reader = new BufferedReader(new InputStreamReader(is));
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1654,17 +1654,17 @@
  /**
   * Writes the java home that we are using for the setup in a file.
   * This way we can use this java home even if the user has not set JAVA_HOME
   * when running the different scripts.
   * This way we can use this java home even if the user has not set
   * OPENDS_JAVA_HOME when running the different scripts.
   *
   */
  protected void writeJavaHome()
  protected void writeOpenDSJavaHome()
  {
    try
    {
      // This isn't likely to happen, and it's not a serious problem even if
      // it does.
      SetupUtils.writeSetJavaHome(getInstallationPath());
      SetupUtils.writeSetOpenDSJavaHome(getInstallationPath());
    } catch (Exception e) {}
  }
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -105,7 +105,7 @@
      checkAbort();
      writeJavaHome();
      writeOpenDSJavaHome();
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -142,7 +142,7 @@
      // Write java home before calling Installation class.  The installation
      // class does a call to start-ds to get information about the build.
      writeJavaHome();
      writeOpenDSJavaHome();
      setInstallation(new Installation(getUserData().getServerLocation()));
      checkAbort();
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -35,6 +35,8 @@
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
import org.opends.quicksetup.util.BackgroundTask;
import org.opends.server.util.SetupUtils;
import static org.opends.quicksetup.util.Utils.*;
import org.opends.messages.MessageBuilder;
import org.opends.messages.Message;
@@ -403,11 +405,7 @@
            pb = new ProcessBuilder(cmd);
          }
          Map<String, String> env = pb.environment();
          env.put("JAVA_HOME", System.getProperty("java.home"));
          /* Remove JAVA_BIN to be sure that we use the JVM running the
           * uninstaller JVM to stop the server.
           */
          env.remove("JAVA_BIN");
          env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
          Process process = pb.start();
          /**
           * Wait for 3 seconds.  Assume that if the process has not exited
opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
@@ -29,6 +29,7 @@
import org.opends.messages.Message;
import org.opends.quicksetup.Installation;
import org.opends.server.util.SetupUtils;
import java.util.logging.Logger;
import java.util.logging.Level;
@@ -113,11 +114,8 @@
    ProcessBuilder pb = new ProcessBuilder(args);
    Map<String, String> env = pb.environment();
    env.put("JAVA_HOME", System.getProperty("java.home"));
    /* Remove JAVA_BIN to be sure that we use the JVM running the
     * uninstaller JVM to run the command.
     */
    env.remove("JAVA_BIN");
    env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
    Process p = pb.start();
    BufferedReader out =
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -34,6 +34,7 @@
import org.opends.quicksetup.*;
import static org.opends.quicksetup.util.Utils.*;
import org.opends.quicksetup.installer.InstallerHelper;
import org.opends.server.util.SetupUtils;
import javax.naming.NamingException;
import java.util.ArrayList;
@@ -128,11 +129,7 @@
      argList.toArray(args);
      ProcessBuilder pb = new ProcessBuilder(args);
      Map<String, String> env = pb.environment();
      env.put("JAVA_HOME", System.getProperty("java.home"));
      /* Remove JAVA_BIN to be sure that we use the JVM running the uninstaller
      * JVM to stop the server.
      */
      env.remove("JAVA_BIN");
      env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
      try {
        Process process = pb.start();
@@ -294,11 +291,7 @@
    ProcessBuilder pb = new ProcessBuilder(args);
    pb.directory(installation.getBinariesDirectory());
    Map<String, String> env = pb.environment();
    env.put("JAVA_HOME", System.getProperty("java.home"));
    /* Remove JAVA_BIN to be sure that we use the JVM running the installer
     * JVM to start the server.
     */
    env.remove("JAVA_BIN");
    env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
    // Upgrader's classpath contains jars located in the temporary
    // directory that we don't want locked by the directory server
opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -39,6 +39,7 @@
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.OperatingSystem;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
@@ -212,7 +213,11 @@
    }
    else
    {
      javaHomeDir = System.getenv(SetupUtils.OPENDS_JAVA_HOME);
      if (javaHomeDir == null)
      {
      javaHomeDir = System.getenv("JAVA_HOME");
      }
      if (javaHomeDir == null)
      {
        javaHomeDir = System.getProperty("java.home");
@@ -250,8 +255,8 @@
      w.println();
      w.println("# Specify the path to the Java installation to use");
      w.println("JAVA_HOME=\"" + javaHomeDir + "\"");
      w.println("export JAVA_HOME");
      w.println("OPENDS_JAVA_HOME=\"" + javaHomeDir + "\"");
      w.println("export OPENDS_JAVA_HOME");
      w.println();
      if (javaArgs.isPresent())
opends/src/server/org/opends/server/util/SetupUtils.java
@@ -57,6 +57,11 @@
  public static final String IS_WEBSTART = "org.opends.quicksetup.iswebstart";
  /**
   * Specific environment variable used by the scripts to find java.
   */
  public static final String OPENDS_JAVA_HOME = "OPENDS_JAVA_HOME";
  /**
   * Java property used to know which are the jar files that must be downloaded
   * lazily.  The current code in WebStartDownloader that uses this property
   * assumes that the URL are separated with an space.
@@ -221,10 +226,10 @@
  /**
   * Write a set-java-home file appropriate for the underlying platform that may
   * be used to set the JAVA_HOME environment variable in a form suitable for
   * the underlying operating system.  If a JAVA_HOME environment variable is
   * currently set, then its value will be used.  Otherwise, it will be
   * dynamically determined from the JVM properties.
   * be used to set the OPENDS_JAVA_HOME environment variable in a form suitable
   * for the underlying operating system.  If a OPENDS_JAVA_HOME environment
   * variable is currently set, then its value will be used.  Otherwise, it will
   * be dynamically determined from the JVM properties.
   * <BR><BR>
   * Note that if the target file that would be written already exists, then
   * this method will exit without doing anything and leaving the existing file
@@ -239,10 +244,10 @@
   * @throws  IOException  If a problem occurs while creating or writing to the
   *                       specified file.
   */
  public static File writeSetJavaHome(String serverRoot)
  public static File writeSetOpenDSJavaHome(String serverRoot)
         throws IOException
  {
    String javaHome = System.getenv("JAVA_HOME");
    String javaHome = System.getenv("OPENDS_JAVA_HOME");
    if ((javaHome == null) || (javaHome.length() == 0))
    {
      javaHome = System.getProperty("java.home");
@@ -262,7 +267,7 @@
      BufferedWriter writer =
           new BufferedWriter(new FileWriter(setJavaHomeFile));
      writer.write("set JAVA_HOME=" + javaHome);
      writer.write("set OPENDS_JAVA_HOME=" + javaHome);
      writer.newLine();
      writer.close();
    }
@@ -279,9 +284,9 @@
      writer.write("#!/bin/sh");
      writer.newLine();
      writer.newLine();
      writer.write("JAVA_HOME=" + javaHome);
      writer.write("OPENDS_JAVA_HOME=" + javaHome);
      writer.newLine();
      writer.write("export JAVA_HOME");
      writer.write("export OPENDS_JAVA_HOME");
      writer.newLine();
      writer.close();
    }