Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51135
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 10:14:19 +0000 (10:14 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 4 May 2011 10:14:19 +0000 (10:14 +0000)
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
webapps/docs/changelog.xml

index 669a77f..c07f1f9 100644 (file)
@@ -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
index e4ed633..5b18aae 100644 (file)
       <update>
         Update commons pool to 1.5.6. (markt)
       </update>
+      <fix>
+        <bug>51135</bug>: Fix auto-detection of JAVA_HOME for 64-bit Windows
+        platforms that only have a 32-bit JVM installed. (markt) 
+      </fix>
     </changelog>
   </subsection>
 </section>