From b05d71f7c4f7cf048f7604559ddca60e26094be9 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 20 Nov 2009 10:41:27 +0000
Subject: [PATCH] Fix for issue 4362 (failure to detect properly installed Java) The fix consists on two parts: 1. Give priority to the java binary set in the path (which is usually updated when java is installed). 2. Check that actually the java binary found in the environment variables does exist.

---
 opends/resource/bin/_script-util.bat |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/opends/resource/bin/_script-util.bat b/opends/resource/bin/_script-util.bat
index 813b37c..635cad8 100644
--- a/opends/resource/bin/_script-util.bat
+++ b/opends/resource/bin/_script-util.bat
@@ -94,11 +94,17 @@
 goto endJavaHomeAndArgs
 
 :checkOpenDSJavaHome
-if "%OPENDS_JAVA_HOME%" == "" goto checkJavaBin
-if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+if "%OPENDS_JAVA_HOME%" == "" goto checkJavaPath
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaPath
 set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
 goto endJavaHomeAndArgs
 
+:checkJavaPath
+java.exe -version > NUL 2>&1
+if not %errorlevel% == 0 goto checkJavaBin
+set OPENDS_JAVA_BIN=java.exe
+goto endJavaHomeAndArgs
+
 :checkJavaBin
 if "%JAVA_BIN%" == "" goto checkJavaHome
 if not exist "%JAVA_BIN%" goto checkJavaHome
@@ -106,17 +112,11 @@
 goto endJavaHomeAndArgs
 
 :checkJavaHome
-if "%JAVA_HOME%" == "" goto checkJavaPath
+if "%JAVA_HOME%" == "" goto noJavaFound
 if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaFound
 set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
 goto endJavaHomeAndArgs
 
-:checkJavaPath
-java.exe -version > NUL 2>&1
-if not %errorlevel% == 0 goto noJavaFound
-set OPENDS_JAVA_BIN=java.exe
-goto endJavaHomeAndArgs
-
 :noJavaFound
 echo ERROR:  Could not find a valid Java binary to be used.
 echo You must specify the path to a valid Java 5.0 or higher version.

--
Gitblit v1.10.0