Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|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

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.

share|improve this answer

I've just encountered the same symptoms, but with a different cause.

At some point in the past I must have placed a copy of ant-1.6.5.jar in ~/.ant/lib. This means ant always tried to use that jar. Solution was to remove the jar from ~/.ant/lib.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .