From 0aba60bbdb852fbd2376a361b1432382176feace Mon Sep 17 00:00:00 2001 From: jvergara <jvergara@localhost> Date: Wed, 06 May 2009 23:41:11 +0000 Subject: [PATCH] Fix for issue 3971 (windows: setup should detect Java automatically) The fix will improve the user experience in Windows when installing from a ZIP file. When the JVM is installed, the java.exe is contained in the PATH environment variable. The fix consists on trying to see if java.exe is on the PATH by calling java.exe -version if no OPENDS_JAVA_HOME nor JAVA_HOME environment variables are defined.. --- opendj-sdk/opends/resource/bin/_script-util.bat | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/opendj-sdk/opends/resource/bin/_script-util.bat b/opendj-sdk/opends/resource/bin/_script-util.bat index 0830b66..ebe3386 100644 --- a/opendj-sdk/opends/resource/bin/_script-util.bat +++ b/opendj-sdk/opends/resource/bin/_script-util.bat @@ -106,11 +106,18 @@ goto endJavaHomeAndArgs :checkJavaHome -if "%JAVA_HOME%" == "" goto noJavaFound +if "%JAVA_HOME%" == "" goto checkJavaPath 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 +set RESULT_CODE=%errorlevel% +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