I started out by trying to run ant on a java program in a RH terminal.

BUILD FAILED
/home/phuong3/soar/soarRepos2/soar/tools/trunk/build.xml:187: Compiler Adapter 'javac1.6' can't be found.

Total time: 0 seconds

I was told that this problem would be fixed if I updated ant from 1.6.5 to 1.7.1. 1.7.1 already exists on the system at /opt/apache-ant-1.7.1/bin. So I changed ANT_HOME to this directory, and appended it to PATH. Now the state is:

[**** trunk]$ echo $ANT_HOME
/opt/apache-ant-1.7.1/bin
[**** trunk]$ ant -version
Apache Ant version 1.6.5 compiled on August 30 2006

So I'm presumably missing a very fundamental step. Can you tell me what it is?

EDIT: Bump. I really could use a hint on this. Is there more information I can provide? Basically what I need to know is, once I already have the Ant 1.7.1 binaries in the system, and ANT_HOME set to this directory, what else do I have to do to make 1.7.1 be the version that's used?

link|improve this question
Is the old version removed from the PATH? it may still be finding that version first. – MaQleod Oct 17 '11 at 17:39
Ahh. PATH includes /usr/bin, and `which ant' -> /usr/bin/ant. So the problem's identified, but how do I fix it? Obviously, I don't want to remove /usr/bin from PATH, right? – Frank Harris Oct 17 '11 at 17:48
You're supposed to construct an absolute path using $ANT_HOME/ant if it's defined, and not rely on a correct $PATH. – Daniel Beck Oct 18 '11 at 18:45
feedback

1 Answer

Solved it myself. Explanation to the best of my ability: Since when I typed in ant, the OS iterated through PATH until it found a directory which contained an executable called ant, the first one it found was going to be the right one. The one I wanted it to execute was LAST in the path. So in bash_profile, instead of export PATH=$PATH:/opt/apache-ant-1.7.1/bin, I did export PATH=/opt/apache-ant-1.7.1/bin:$PATH. Now, the desired version of ant shows up first and is the one executed.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.