From 3df12a15b1a21747ac51548e7be95ba72e55d449 Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Fri, 27 Sep 2019 14:59:13 -0500 Subject: [PATCH] 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). --- assembly/src/release/bin/activemq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assembly/src/release/bin/activemq b/assembly/src/release/bin/activemq index 358204b726..c8d7f031d2 100755 --- a/assembly/src/release/bin/activemq +++ b/assembly/src/release/bin/activemq @@ -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