mirror of https://github.com/apache/activemq.git
Improve activemq init JAVACMD auto detection
If JAVACMD is set to "auto" (the default from the "env" file) and the current working directory contains a directory named "auto", the activemq init script will incorrectly detect the "auto" directory as the "java" binary thus leaving JAVACMD set to "auto" which is incorrect and will obviously fail to execute the Java VM. To fix this, in the second attempt to detect the "java" binary, repeat the tests for a zero-length JAVACMD or a JAVACMD equal to "auto" before testing whether JAVACMD does not exist or is not executable. This is necessary because when JAVA_HOME's length is zero, the first attempt to detect the location of the "java" binary will not set JAVACMD (so it will still be "auto" when it reaches the second auto-detection attempt).
This commit is contained in:
parent
1ab6793c85
commit
3df12a15b1
|
@ -245,7 +245,7 @@ if [ -z "$JAVACMD" ] || [ "$JAVACMD" = "auto" ] ; then
|
|||
fi
|
||||
|
||||
# Hm, we still do not know the location of the java binary
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
if [ -z "$JAVACMD" ] || [ "$JAVACMD" = "auto" ] || [ ! -x "$JAVACMD" ] ; then
|
||||
JAVACMD=`which java 2> /dev/null `
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
JAVACMD=java
|
||||
|
|
Loading…
Reference in New Issue