gerrit.sh: Improve error message when JRE cannot be found

If a JRE cannot be found at the location specified by JAVA_HOME or
container.javaHome, the server startup fails and an error message is
displayed.

Update the error message so that the reader realizes that while the
JAVA_HOME and/or container.javaHome might be *set* the value in them
might not be *valid*. An example of when this might be the case is when
the java installation was upgraded and the location changed from:

  /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre

to:

  /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre

and while the JAVA_HOME environment variable got update to the new
location, container.javaHome did not and still pointed to the old (and
now invalid) location.

Change-Id: I24e0dc19781920e8901ef8743c847606ebd640ce
This commit is contained in:
David Pursehouse 2019-02-18 16:00:36 +09:00
parent 73dfbc6b33
commit 436e7b79b2
1 changed files with 3 additions and 3 deletions

View File

@ -259,9 +259,9 @@ if test -z "$JAVA" \
fi
if test -z "$JAVA" ; then
echo >&2 "Cannot find a JRE or JDK. Please set JAVA_HOME or"
echo >&2 "container.javaHome in $GERRIT_SITE/etc/gerrit.config"
echo >&2 "to a >=1.7 JRE"
echo >&2 "Cannot find a JRE or JDK. Please ensure that the JAVA_HOME environment"
echo >&2 "variable or container.javaHome in $GERRIT_SITE/etc/gerrit.config is"
echo >&2 "set to a valid >=1.7 JRE location"
exit 1
fi