From 69287099bab9640465cb18ef4006252d05a33e5d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 28 Sep 2007 19:50:40 +0000
Subject: [PATCH] Fix for issue 2035 (Use OpenDS specific environment variables to determine the JVM to be used.)

---
 opends/resource/bin/status-panel.bat |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/opends/resource/bin/status-panel.bat b/opends/resource/bin/status-panel.bat
index 834db2d..738ea93 100644
--- a/opends/resource/bin/status-panel.bat
+++ b/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

--
Gitblit v1.10.0