问题
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.
回答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
回答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
回答3:
try looking in /usr/bin folder .. it should tell you where it is installed.
回答4:
I do not had ANT
at all in whole system, but i use NetBeans 8.1 or 8.2.
Step 1: Install NetBeans 8.2
Step 2: Apply the ant from NetBeans 8.2 does the easy job too
$ "/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/bin/ant" -diagnostics
------- Ant diagnostics report -------
Apache Ant(TM) version 1.9.7 compiled on April 9 2016
-------------------------------------------
Implementation Version
-------------------------------------------
core tasks : 1.9.7 in file:/Applications/NetBeans/NetBeans%208.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar
-------------------------------------------
ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant(TM) version 1.9.7 compiled on April 9 2016
ant.java.version: 1.8
Is this the Apache Harmony VM? no
Is this the Kaffe VM? no
Is this gij/gcj? no
ant.core.lib: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar
ant.home: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
ant-antlr.jar (11563 bytes)
ant-apache-bcel.jar (15077 bytes)
ant-apache-bsf.jar (9827 bytes)
ant-apache-log4j.jar (8676 bytes)
ant-apache-oro.jar (9805 bytes)
ant-apache-regexp.jar (9671 bytes)
ant-apache-resolver.jar (9748 bytes)
ant-apache-xalan2.jar (8197 bytes)
ant-commons-logging.jar (9791 bytes)
ant-commons-net.jar (90789 bytes)
ant-jai.jar (28321 bytes)
ant-javamail.jar (13778 bytes)
ant-jdepend.jar (13826 bytes)
ant-jmf.jar (12386 bytes)
ant-jsch.jar (48991 bytes)
ant-junit.jar (117485 bytes)
ant-junit4.jar (13196 bytes)
ant-launcher.jar (18334 bytes)
ant-netrexx.jar (16279 bytes)
ant-swing.jar (13274 bytes)
ant-testutil.jar (27034 bytes)
ant.jar (2027962 bytes)
-------------------------------------------
USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: /Users/sun
No such directory.
-------------------------------------------
Tasks availability
-------------------------------------------
sshexec : Missing dependency com.jcraft.jsch.Logger
scp : Missing dependency com.jcraft.jsch.Logger
sshsession : Missing dependency com.jcraft.jsch.Logger
jdepend : Missing dependency jdepend.xmlui.JDepend
A task being missing/unavailable should only matter if you are trying to use it
-------------------------------------------
org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/
-------------------------------------------
XML Parser information
-------------------------------------------
XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
XML Parser Location: unknown
Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Namespace-aware parser Location: unknown
-------------------------------------------
XSLT Processor information
-------------------------------------------
XSLT Processor : com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
XSLT Processor Location: unknown
-------------------------------------------
System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib
java.vm.version : 25.31-b07
ant.library.dir : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib
user.country.format : BE
gopherProxySet : false
java.vm.vendor : Oracle Corporation
java.vendor.url : http://java.oracle.com/
path.separator : :
java.vm.name : Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg : sun.io
user.country : US
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /Users/sun/Desktop/android/android-webrtc-master
java.runtime.version : 1.8.0_31-b13
java.awt.graphicsenv : sun.awt.CGraphicsEnvironment
java.endorsed.dirs : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/endorsed
os.arch : x86_64
java.io.tmpdir : /var/folders/zq/zqbl2b1x43g6kq5bxmgx39880000gn/T/
line.separator :
java.vm.specification.vendor : Oracle Corporation
os.name : Mac OS X
ant.home : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant
sun.jnu.encoding : UTF-8
java.library.path : /Users/sun/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
java.specification.name : Java Platform API Specification
java.class.version : 52.0
sun.management.compiler : HotSpot 64-Bit Tiered Compilers
os.version : 10.11.6
http.nonProxyHosts : local|*.local|169.254/16|*.169.254/16
user.home : /Users/sun
user.timezone : Europe/Brussels
java.awt.printerjob : sun.lwawt.macosx.CPrinterJob
java.specification.version : 1.8
file.encoding : UTF-8
user.name : sun
java.class.path : /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-launcher.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-antlr.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-bcel.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-bsf.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-log4j.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-oro.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-regexp.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-resolver.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-apache-xalan2.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-commons-logging.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-commons-net.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jai.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-javamail.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jdepend.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jmf.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-jsch.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-junit.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-junit4.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-launcher.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-netrexx.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-swing.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant-testutil.jar:/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/extide/ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/lib/tools.jar
java.vm.specification.version : 1.8
sun.arch.data.model : 64
java.home : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre
sun.java.command : org.apache.tools.ant.launch.Launcher -cp -diagnostics
java.specification.vendor : Oracle Corporation
user.language : en
awt.toolkit : sun.lwawt.macosx.LWCToolkit
java.vm.info : mixed mode
java.version : 1.8.0_31
java.ext.dirs : /Users/sun/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
sun.boot.class.path : /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre/classes
java.vendor : Oracle Corporation
file.separator : /
java.vendor.url.bug : http://bugreport.sun.com/bugreport/
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeBig
socksNonProxyHosts : local|*.local|169.254/16|*.169.254/16
ftp.nonProxyHosts : local|*.local|169.254/16|*.169.254/16
sun.cpu.isalist :
-------------------------------------------
Temp dir
-------------------------------------------
Temp dir is /var/folders/zq/zqbl2b1x43g6kq5bxmgx39880000gn/T/
Temp dir is writeable
Temp dir alignment with system clock is -6 ms
-------------------------------------------
Locale information
-------------------------------------------
Timezone Central European Time offset=3600000
-------------------------------------------
Proxy information
-------------------------------------------
http.nonProxyHosts = "local|*.local|169.254/16|*.169.254/16"
ftp.nonProxyHosts = "local|*.local|169.254/16|*.169.254/16"
Java1.5+ proxy settings:
Direct connection
来源:https://stackoverflow.com/questions/4823367/where-is-ant-installed-on-mac-os-x-snow-leopard-by-default