I've been having a similar problem when either trying to install
ant-1.4.1 (from source) or run the binary distribution. I have
jdk1.3.1_02 installed, and `java -version` runs fine (when testing that
'java' is in the path).

I defined the following environment variables in /etc/profile (and
checked to make sure they are correct and set in my current shell):


JAVA_HOME="/usr/java/jdk1.3.1_02"
ANT_HOME="/usr/java/ant"
PATH="${PATH}:/usr/local/bin:/usr/X11R6/bin:/usr/local/sbin:${JAVA_HOME}
/bin:${ANT_HOME}/bin"


When trying to install from source:


[root@tethys jakarta-ant-1.4.1]# ./build.sh -Ddist.dir=/usr/java/ant
dist
Warning: JAVA_HOME environment variable not set.
  If build fails because sun.* classes could not be found
  you will need to set the JAVA_HOME environment variable
  to the installation directory of java.
Error: JAVA_HOME is not defined correctly.
  We cannot execute java
Bootstrap FAILED


When trying to run after installing the binary distro:


[root@tethys /root]# ant
Error: JAVA_HOME is not defined correctly.
  We cannot execute java


(Yes, I have a build.xml file in the current directory when I do this,
but the ant shell script never even gets that far.)

After finding out that there's no real reason to install from source,
I've tracked down the error to the following lines in the 'ant' shell
script:


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
fi

The [ -n "$JAVA_HOME" ] condition *should* evaluate to true. I even test
it in the same shell I executed 'ant' from with success. All the same,
$JAVACMD evaluates to "java" after the first main 'if' statement.

This *could* be fine, as 'java' is in my path, and when I tried, [ -x
"java" ] evaluates to true -- but all the same, the second main 'if'
statement gets executed and 'ant' exits.

I'm not a BASH expert, so I think I've hit the limits of my
troubleshooting expertise here. File and environment variable tests that
evaluate one way when I do them evaluate oppositely when these shell
scripts ('ant' and 'bootstrap.sh') test them. I'm stumped.

Any ideas would be appreciated.

Dean.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to