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
The following commit(s) were added to refs/heads/main by this push:
new a788852f6b Improve messages if JAVA_HOME / JRE_HOME not set correctly
a788852f6b is described below
commit a788852f6b48e100bd505dcf7b5633a04f649e7b
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Apr 11 11:41:55 2023 +0100
Improve messages if JAVA_HOME / JRE_HOME not set correctly
---
bin/setclasspath.sh | 24 +++++++++++++++++++++---
webapps/docs/changelog.xml | 6 ++++++
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh
index b81bc197d1..f56b2aa473 100755
--- a/bin/setclasspath.sh
+++ b/bin/setclasspath.sh
@@ -53,15 +53,13 @@ if [ -z "$JAVA_HOME" ] && [ "$1" = "debug" ]; then
echo "JAVA_HOME should point to a JDK in order to run in debug mode."
exit 1
fi
-if [ -z "$JRE_HOME" ]; then
- JRE_HOME="$JAVA_HOME"
-fi
# If we're running under jdb, we need a full jdk.
if [ "$1" = "debug" ] ; then
if [ "$os400" = "true" ]; then
if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
+ echo "JAVA_HOME=$JAVA_HOME"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
@@ -69,6 +67,7 @@ if [ "$1" = "debug" ] ; then
else
if [ ! -x "$JAVA_HOME"/bin/java ] || [ ! -x "$JAVA_HOME"/bin/jdb ] || [ !
-x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
+ echo "JAVA_HOME=$JAVA_HOME"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
@@ -76,6 +75,25 @@ if [ "$1" = "debug" ] ; then
fi
fi
+if [ -z "$JRE_HOME" ]; then
+ # JAVA_HOME_MUST be set
+ if [ ! -x "$JAVA_HOME"/bin/java ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly"
+ echo "JAVA_HOME=$JAVA_HOME"
+ echo "This environment variable is needed to run this program"
+ echo "NB: JAVA_HOME should point to a JDK not a JRE"
+ exit 1
+ fi
+ JRE_HOME="$JAVA_HOME"
+else
+ if [ ! -x "$JRE_HOME"/bin/java ]; then
+ 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"
+ exit 1
+ fi
+fi
+
# Set standard commands for invoking Java, if not already set.
if [ -z "$_RUNJAVA" ]; then
_RUNJAVA="$JRE_HOME"/bin/java
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9b8cf45186..80eda46d47 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -295,6 +295,12 @@
2.10.0-SNAPSHOT). This corrects a regression introduced in 11.0.0-M2.
(markt)
</update>
+ <fix>
+ Improve the error messages if <code>JRE_HOME</code> or
+ <code>JAVA_HOME</code> are not set correctly. On windows, align the
+ handling of <code>JRE_HOME</code> and <code>JAVA_HOME</code> for the
+ start-up scripts and the service install script. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]