我没有设置ANT_HOME,因此想找到ant的主目录在哪里。我使用的是默认安装在我的OSX上的ant版本。
我没有设置ANT_HOME环境变量,想知道ant的主目录在哪里。我正在使用安装在我的OSX上的默认ant版本。我没有设置ANT_HOME,因此想找到ant的主目录在哪里。我使用的是默认安装在我的OSX上的ant版本。
我没有设置ANT_HOME环境变量,想知道ant的主目录在哪里。我正在使用安装在我的OSX上的默认ant版本。按照以下步骤查找任何软件包的位置:
whereis ant (replace 'ant' with whatever you're looking for)
在我的计算机上,这报告如下:
/usr/bin/ant
所以,我做了:ls -l /usr/bin/ant
在我的电脑上,这报告如下:lrwxr-xr-x 1 root wheel 22 Nov 30 17:09 /usr/bin/ant -> /usr/share/ant/bin/ant
所以,我做:
ls -l /usr/share/ant
并获得:
lrwxr-xr-x 1 root wheel 14 Nov 30 17:09 /usr/share/ant -> java/ant-1.8.1
通过这个可以推断出 Ant 安装在 /usr/share/ant/java/ant-1.8.1
目录下。
如果你运行 ant -diagnostics 命令,它会告诉你 ant.home 的路径。
$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
错误:找不到或加载主类org.apache.tools.ant.launch.Launcher
。 - IgorGanapolskyANT
,但我使用的是NetBeans 8.1或8.2。
步骤1:安装NetBeans 8.2。
步骤2:从NetBeans 8.2中应用ANT
也很容易。$ "/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
尝试查看 /usr/bin 文件夹...它应该会告诉你它安装在哪里。
ant -diagnostics | grep ant.home
更准确。 - derFunkfind / -name“ant”-type f
。 - derFunk