Actually I have installed Ant in rhel5 environment and set ANT_HOME variable in /etc/profile which points to /usr/local/ant/bin so when I execute command echo $ANT_HOME it gives correct path but I get ant:command not found when I tried executing it from other directory. I installed it using a tar named apache-ant-1.7.1-bin.tar.gz and untared it.

I tried the command below ln -s /usr/local/ant/apache-ant-1.7.1/bin /usr/local/ant/apache-ant-1.7.1/bin/ant ln: creating symbolic link /usr/local/ant/apache-ant-1.7.1/bin/ant' to /usr/local/ant/apache-ant-1.7.1/bin': File exists but when I run ant it still says command not found

  • 1
    What directory is ant installed in? You may want to copy it (or use a symlink) so that it is in one of the directories in your $PATH. /usr/local/bin may be a good choice to copy it to. – Mark Plotnick Aug 5 '14 at 14:37
  • Did you install from source or an rpm? You need the ant binary in your $PATH in addition to any _HOME environment vars, but a package should have done that for you, e.g. by having a symlink from /usr/local/bin/ant to /usr/local/ant/bin/ant. – Ulrich Schwarz Aug 5 '14 at 14:38
  • Yeah I have added the required detail actually I am new to linux so can you give me some pointers about symbolic link – SME Aug 6 '14 at 5:24

This should make it work:

export PATH=$PATH:/usr/local/ant/apache-ant-1.7.1/bin

Make sure you update this PATH in your .bash_profile file or in any of the startup scripts under /etc/profile.d

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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