Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.8
-
None
-
Patch
Description
In the mvn shell script, when the JAVA_HOME environment variable is not set, the script sets JAVACMD to java, probably as a best effort, hoping it is on the user's PATH. 4 lines beneath that, the JAVACMD is tested for executability, but since it is not a path to the java executable, but just the java command, this fails.
The relevant part of the script (lines 122-139):
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=java
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit 1
fi
Line 131 should be changed to:
JAVACMD="`which java`"