You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/12/05 10:56:32 UTC

[tomcat] branch master updated: Expand Java search path for Windows installer to JDK and JAVA_HOME

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 709a331  Expand Java search path for Windows installer to JDK and JAVA_HOME
709a331 is described below

commit 709a331db6fa8ab510809b523cb7df0d76799a87
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Dec 5 10:55:44 2019 +0000

    Expand Java search path for Windows installer to JDK and JAVA_HOME
    
    Pull Request provided by Alexander Norz
---
 res/tomcat.nsi             | 26 ++++++++++++++++++++++++--
 webapps/docs/changelog.xml |  6 ++++++
 webapps/docs/setup.xml     | 17 +++++++++++------
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/res/tomcat.nsi b/res/tomcat.nsi
index 5ab5f60..60d1f09 100644
--- a/res/tomcat.nsi
+++ b/res/tomcat.nsi
@@ -964,6 +964,27 @@ Function findJavaHome
     ${EndIf}
   ${EndIf}
 
+  ; If no 32-bit Java (JRE) found, look for 64-bit Java JDK
+  ${If} $1 == ""
+  ${AndIf} $0 != "%PROGRAMW6432%"
+    ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\JDK" "CurrentVersion"
+    ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\JDK\$2" "JavaHome"
+    ; "RuntimeLib" is not available here
+
+    IfErrors 0 +2
+    StrCpy $1 ""
+    ClearErrors
+  ${EndIf}
+
+  ; If nothing found, try environment variable JAVA_HOME
+  ${If} $1 == ""
+    ExpandEnvStrings $1 "%JAVA_HOME%"
+    ${If} $1 == "%JAVA_HOME%"
+      StrCpy $1 ""
+    ${EndIf}
+    ClearErrors
+  ${EndIf}
+
   ; Put the result in the stack
   Push $1
 
@@ -1007,12 +1028,13 @@ Function findJVMPath
   IfFileExists "$2" FoundJvmDll
 
   ClearErrors
-  ;Step three: Read defaults from registry
 
+  ;Step three: Read defaults from registry
   ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
   ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "RuntimeLib"
-
   IfErrors 0 FoundJvmDll
+
+  ;not found
   StrCpy $2 ""
 
   FoundJvmDll:
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 19aafe6..250edef 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -174,6 +174,12 @@
       <update>
         Support Java 11 in Graal Native Images with Graal 19.3+. (remm)
       </update>
+      <add>
+        Expand the search made by the Windows installer for a suitable Java
+        installation to include the 64-bit JDK registry entries and the
+        <code>JAVA_HOME</code> environment variable. Pull request provided by
+        Alexander Norz. (markt)
+      </add>
     </changelog>
   </subsection>
 </section>
diff --git a/webapps/docs/setup.xml b/webapps/docs/setup.xml
index 6047dcc..3655063 100644
--- a/webapps/docs/setup.xml
+++ b/webapps/docs/setup.xml
@@ -61,12 +61,17 @@
             administration tool and its documentation).</li>
         <li><strong>Java location</strong>: The installer will provide a default
             JRE to use to run the service. The installer uses the registry to
-            determine the base path of a Java <min-java-version/> or later JRE, including the JRE
-            installed as part of the full JDK. When running on a 64-bit
-            operating system, the installer will first look for a 64-bit JRE and
-            only look for a 32-bit JRE if a 64-bit JRE is not found. It is not
-            mandatory to use the default JRE detected by the installer. Any
-            installed Java <min-java-version/> or later JRE (32-bit or 64-bit) may be used.</li>
+            determine the base path of a Java <min-java-version/> or later JRE,
+            including the JRE installed as part of the full JDK. When running on
+            a 64-bit operating system, the installer will first look for a
+            64-bit JRE and only look for a 32-bit JRE if a 64-bit JRE is not
+            found. If a JRE cannot be found when running on a 64-bit operating
+            system, the installer will look for a 64-bit JDK. Finally, if a JRE
+            or JDK has not been found, the installer will try to use the
+            <code>JAVA_HOME</code> environment variable. It is not mandatory to
+            use the default JRE detected by the installer. Any installed Java
+            <min-java-version/> or later JRE (32-bit or 64-bit) may be
+            used.</li>
         <li><strong>Tray icon</strong>: When Tomcat is run as a service, there
             will not be any tray icon present when Tomcat is running. Note that
             when choosing to run Tomcat at the end of installation, the tray


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org