[英]Given that NetBeans is installed, how can I use ant from the command-line (on Windows)?
I have NetBeans 8.0.2 installed on my Windows 7 (64-bit) machine. 我在Windows 7(64位)计算机上安装了NetBeans 8.0.2。 I have also the JDK installed (Java SE Development Kit 8 update 66 (64-bit)).
我还安装了JDK(Java SE Development Kit 8更新66(64位))。
I want to run ant
from the command line, but the closest I think I've come to getting it to run is the following: 我想从命令行运行
ant
,但是我认为使它运行最接近的方法如下:
java -jar "C:\Program Files\NetBeans 8.0.2\extide\ant\lib\ant.jar"
but I got the error 但我得到了错误
Error: Could not find or load main class org.apache.tools.ant.Main
I also tried the following, thinking that Main.class
might be inside ant.jar
, but got the same error: 我还尝试了以下操作,以为
Main.class
可能位于ant.jar
,但出现了相同的错误:
java -cp "C:\Program Files\NetBeans 8.0.2\extide\ant\lib\ant.jar" -jar "C:\Program Files\NetBeans 8.0.2\extide\ant\lib\ant.jar"
I've spent at least an hour searching online and StackOverflow for the anser. 我花了至少一个小时在网上搜索,并在StackOverflow上搜索了分析服务。 The closest I've found is Compile NetBeans project from command line by using Ant , but it assumes that
ant
is accessible from the command line already. 我找到的最接近的是使用Ant从命令行编译NetBeans项目 ,但是它假定可以从命令行访问
ant
。
ant
to work from the command line ant
以从命令行工作 C:\\Program Files\\NetBeans 8.0.2\\extide\\ant\\bin
to your PATH C:\\Program Files\\NetBeans 8.0.2\\extide\\ant\\bin
到PATH JAVA_HOME
with the value C:\\Program Files\\Java\\jdk1.8.0_66
(adjust this if you end up using a different version, of course). C:\\Program Files\\Java\\jdk1.8.0_66
的环境变量JAVA_HOME
(当然,如果最终使用其他版本,请进行调整)。 ant
from the command line normally. ant
即可。 To rebuild the project, for example, simply do the following: 例如,要重建项目,只需执行以下操作:
ant clean jar
ant clean jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.