Skip to content

Commit

Permalink
Permit relative path or $PATH searches for the java command.
Browse files Browse the repository at this point in the history
This fixes the following broken in elastic#1189:

    % bin/logstash
    => Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.
  • Loading branch information
jordansissel committed Apr 16, 2014
1 parent bfc7619 commit c471297
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/logstash.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ setup_java() {
else
JAVACMD="java"
fi
else
JAVACMD=$(which $JAVACMD 2>/dev/null)
fi

if [ "$(basename $JAVACMD)" = "drip" ] ; then
export DRIP_INIT_CLASS="org.jruby.main.DripMain"
export DRIP_INIT=
# Resolve full path to the java command.
if [ ! -f "$JAVACMD" ] ; then
JAVACMD=$(which $JAVACMD 2>/dev/null)
fi

if [ ! -x "$JAVACMD" ] ; then
echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME."
exit 1
fi

if [ "$(basename $JAVACMD)" = "drip" ] ; then
export DRIP_INIT_CLASS="org.jruby.main.DripMain"
export DRIP_INIT=
fi

JAVA_OPTS="$JAVA_OPTS -Xmx${LS_HEAP_SIZE}"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
Expand Down

0 comments on commit c471297

Please sign in to comment.