How to find out the correct path for ANT_HOME in Linux?

19,478

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.

Share:
19,478

Related videos on Youtube

automatix
Author by

automatix

Updated on September 18, 2022

Comments

  • automatix
    automatix over 1 year

    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?

    • Alin Andrei
      Alin Andrei about 8 years
      use export ANT_HOME='/usr/bin', or use this link provided by oracle
    • automatix
      automatix almost 8 years
      @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
    automatix almost 8 years
    Thank you very much fr your answer! Could you please (if possible) add a reference to it, where you have the info from. Thanks
  • ALex_hha
    ALex_hha almost 8 years
    As I have told above, I've just checked the script /usr/share/ant/bin/ant