2

I'm using Ubuntu 14.04 (on a VirtualBox VM) and installed Apache Ant via aptitude:

$ aptitude install ant

The binary is stored in /usr/bin/:

$ which ant
/usr/bin/ant

Now I want to set ANT_HOME and also add it to my PATH environment variable. On Windows it would be easy to find the correct folder -- ANT_HOME is the folder, where the installation is stored and looks like C:\Program Files\Apache Ant (or simply the parent directory of the folder with the Ant binaries).

How to find out the correct path for ANT_HOME in a Linux system (e.g. Ubuntu Server)?


UPDATE

The documentation on the Oracle website says:

Add the following lines to the file, substituting the directory where you installed Ant:

ANT_HOME=/apache-install-dir/apache-ant-version

How to find out the path to the apache-install-dir?

2
  • use export ANT_HOME='/usr/bin', or use this link provided by oracle Apr 11, 2016 at 6:48
  • @AlinAndrei Thanks for your comment, but what I'd actually like to know is not how to set the environment variable, but how to know / how to find out, which path for ANT_HOME is correct on a Linux machine. So did you mean, the ANT_HOME is always the folder with executables, where the Ant executable is?
    – automatix
    May 30, 2016 at 7:44

1 Answer 1

6

On CentOS/Ubuntu ANT_HOME should be /usr/share/ant/. You can check /usr/share/ant/bin/ant, it's just a bash script

# load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
  if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
      if [ -f "/etc/ant.conf" ] ; then
          . /etc/ant.conf
      fi
  fi

So if you didn't specify explicitly ANT_HOME, /usr/share/ant will be used by default.

2
  • Thank you very much fr your answer! Could you please (if possible) add a reference to it, where you have the info from. Thanks
    – automatix
    May 30, 2016 at 9:18
  • As I have told above, I've just checked the script /usr/share/ant/bin/ant
    – ALex_hha
    May 30, 2016 at 9:36

You must log in to answer this question.

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