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

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

commit eb981f73ee70b799dcd9dcd6694c9084d36169c7
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Apr 11 10:50:04 2023 +0100

    Improve messages for invalid JRE_HOME/JAVA_HOME
---
 bin/setclasspath.bat | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat
index 41548ef726..62e5d70cb3 100755
--- a/bin/setclasspath.bat
+++ b/bin/setclasspath.bat
@@ -42,13 +42,23 @@ goto okJava
 
 :noJavaHome
 echo The JAVA_HOME environment variable is not defined correctly.
+echo JAVA_HOME=%JAVA_HOME%
 echo It is needed to run this program in debug mode.
 echo NB: JAVA_HOME should point to a JDK not a JRE.
 goto exit
 
 :gotJavaHome
-rem No JRE given, use JAVA_HOME as JRE_HOME
+rem No JRE given, check if JAVA_HOME is usable as JRE_HOME
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHomeAsJre
+rem Use JAVA_HOME as JRE_HOME
 set "JRE_HOME=%JAVA_HOME%"
+goto okJava
+
+:noJavaHomeAsJre
+echo The JAVA_HOME environment variable is not defined correctly.
+echo JAVA_HOME=%JAVA_HOME%
+echo NB: JAVA_HOME should point to a JDK not a JRE.
+goto exit
 
 :gotJreHome
 rem Check if we have a usable JRE
@@ -58,6 +68,7 @@ goto okJava
 :noJreHome
 rem Needed at least a JRE
 echo The JRE_HOME environment variable is not defined correctly
+echo JRE_HOME=%JRE_HOME%
 echo This environment variable is needed to run this program
 goto exit
 


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

Reply via email to