From faf3c64a76a35c3dec8f7b503ea54e589ed69f76 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 4 May 2011 10:14:19 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51135 Fix auto-detection of JAVA_HOME for 64-bit Windows platforms that only have a 32-bit JVM installed. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099394 13f79535-47bb-0310-9956-ffa450edef68 --- res/tomcat.nsi | 35 ++++++++++++++++++++++++----------- webapps/docs/changelog.xml | 4 ++++ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/res/tomcat.nsi b/res/tomcat.nsi index 669a77f89..c07f1f9e9 100644 --- a/res/tomcat.nsi +++ b/res/tomcat.nsi @@ -635,22 +635,35 @@ Function findJavaHome ClearErrors - ; Use the 64-bit registry on 64-bit machines + ; Use the 64-bit registry first on 64-bit machines ExpandEnvStrings $0 "%PROGRAMW6432%" ${If} $0 != "%PROGRAMW6432%" SetRegView 64 - ${EndIf} - - ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion" - ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "JavaHome" - ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "RuntimeLib" + ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion" + ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "JavaHome" + ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "RuntimeLib" - IfErrors 0 NoErrors - StrCpy $1 "" - -NoErrors: + IfErrors 0 +2 + StrCpy $1 "" + ClearErrors + ${EndIf} - ClearErrors + ; If no 64-bit Java was found, look for 32-bit Java + ${If} $1 == "" + SetRegView 32 + ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion" + ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "JavaHome" + ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "RuntimeLib" + + IfErrors 0 +2 + StrCpy $1 "" + ClearErrors + + ; If using 64-bit, go back to using 64-bit registry + ${If} $0 != "%PROGRAMW6432%" + SetRegView 64 + ${EndIf} + ${EndIf} ; Put the result in the stack Push $1 diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e4ed633c5..5b18aae00 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -186,6 +186,10 @@ Update commons pool to 1.5.6. (markt) + + 51135: Fix auto-detection of JAVA_HOME for 64-bit Windows + platforms that only have a 32-bit JVM installed. (markt) + -- 2.11.0