JAVACMD set incorrectly when JAVA_HOME is not set
-------------------------------------------------

                 Key: MNG-3310
                 URL: http://jira.codehaus.org/browse/MNG-3310
             Project: Maven 2
          Issue Type: Bug
          Components: Command Line
    Affects Versions: 2.0.8
            Reporter: Matthijs Wensveen
         Attachments: mvn.patch

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`"


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to