where is ant installed on Mac OS X snow leopard by default?
34,432
Solution 1
Follow these instructions to find the location of any package:
whereis ant (replace 'ant' with whatever you're looking for)
On my machine, this reports:
/usr/bin/ant
so, I do:
ls -l /usr/bin/ant
on my machine this reports:
lrwxr-xr-x 1 root wheel 22 Nov 30 17:09 /usr/bin/ant -> /usr/share/ant/bin/ant
so, I do :
ls -l /usr/share/ant
and get:
lrwxr-xr-x 1 root wheel 14 Nov 30 17:09 /usr/share/ant -> java/ant-1.8.1
from this I can surmise that ant is installed at /usr/share/ant/java/ant-1.8.1
Solution 2
If you run ant -diagnostics, it should tell you where the ant.home is
$ant -diagnostics
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
ant.java.version: 1.6
ant.core.lib: /opt/local/share/java/apache-ant/lib/ant.jar
ant.home: /opt/local/share/java/apache-ant
Author by
czer
Updated on July 09, 2022Comments
-
czer almost 2 years
I don't have ANT_HOME set, so i want to find where the home directory of ant is. I'm using the version of ant that was installed by default on my OSX install.
-
Chilloutman about 12 yearsYou can also do "which ant" instead of using "whereis..."
-
cutebug almost 11 yearsCorrection: The path would be /usr/share/java/ant-1.8.1
-
derFunk over 9 yearsThis dies not help to find the location of ANT_HOME on every system. Using
ant -diagnostics | grep ant.home
is more precise. -
derFunk over 9 yearsI admit the question could be confusing. Not having ANT_HOME set as an exported environment variable on OSX seems to be totally common, at least on the 10 OSX servers I manage. Nevertheless ant -diagnostic tells you its default value of ant.home, even if the environment variable ANT_HOME is not set. If ant is not even on the PATH, which wouldn't allow for querying the diagnostics, and you're looking for the binary, you may even want to use
find / -name "ant" -type f
. -
IgorGanapolsky about 8 yearsThis produces an error:
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
-
Abu Shoeb about 2 years@IgorGanapolsky you probably need to add your JAVA_HOME in env variable