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

jvergara
25.13.2007 5c961270fe3401ebb151b857e9e6bb3443aa0ffc
Fix for issue 1273 (exception if JAVA_HOME undefined in scripts).

The fix consists of modifying the scripts to launch the InstallDS classwith a test option using the JVM that was found. If the JVM can be successfully launched, the JVM is compatible with 1.5, if not we as sume that is not compatible with JDK 1.5.

The downside of the fix is that it requires an additional start of the JVM each time the command line is launched. That is why the fix only applies to setup, uninstall, upgrade, start and stop command lines. The modifications in _server-script.* and _client-script.sh just modify the message displayed when a JVM could not be found (informing that JDK 1.5 or later can be used).
6 files modified
51 ■■■■ changed files
opends/resource/setup 6 ●●●● patch | view | raw | blame | history
opends/resource/setup.bat 10 ●●●●● patch | view | raw | blame | history
opends/resource/uninstall 6 ●●●● patch | view | raw | blame | history
opends/resource/uninstall.bat 11 ●●●●● patch | view | raw | blame | history
opends/resource/upgrade 6 ●●●● patch | view | raw | blame | history
opends/resource/upgrade.bat 12 ●●●●● patch | view | raw | blame | history
opends/resource/setup
@@ -43,7 +43,7 @@
      then
        export JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
        echo "Please set JAVA_HOME to the root of a Java 5  (or later) installation."
        exit 1
      fi
    fi
@@ -102,7 +102,7 @@
    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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
@@ -111,7 +111,7 @@
  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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
    exit 1
  fi
fi
opends/resource/setup.bat
@@ -48,15 +48,23 @@
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 installation.
echo        Please set it to a valid Java 5 (or later) installation.
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.
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%*" == "" goto callLaunch
goto callJava
opends/resource/uninstall
@@ -43,7 +43,7 @@
      then
        export JAVA_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
    fi
@@ -101,7 +101,7 @@
    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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
@@ -110,7 +110,7 @@
  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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
    exit 1
  fi
fi
opends/resource/uninstall.bat
@@ -48,7 +48,12 @@
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 installation.
echo        Please set it to a valid Java 5 (or later) installation.
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.
goto end
:setClassPath
@@ -56,6 +61,10 @@
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%*" == "" goto callLaunch
goto callJava
opends/resource/upgrade
@@ -47,7 +47,7 @@
        export JAVA_BIN
        export JAVAWS_BIN
      else
        echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
        echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
        exit 1
      fi
    fi
@@ -111,7 +111,7 @@
    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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
      exit 1
    fi
  fi
@@ -120,7 +120,7 @@
  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 "        JAVA_HOME to the root of a Java 5 (or later) installation."
    exit 1
  fi
fi
opends/resource/upgrade.bat
@@ -53,13 +53,23 @@
:noSetJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 installation.
echo        Please set it to a valid Java 5 (or later) installation.
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.
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
if not %errorlevel% == 0 goto noValidJavaHome
if "%*" == "" goto callWebStartUpgrade
:callExtractor
if EXIST .\tmp\upgrade rd .\tmp\upgrade /s /q
set CLASSPATH=""