使用 Ant 从命令行编译 NetBeans 项目 [英] Compile NetBeans project from command line by using Ant

查看:37
本文介绍了使用 Ant 从命令行编译 NetBeans 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 NetBeans 项目,我想从命令行编译.StackOverflow 上还有很多关于如何执行的问题,但它们解释了如何使用诸如 javac src/*.java 之类的命令来编译项目.

I have a NetBeans project I would like to compile from the command line. There are many other questions on StackOverflow about how to do so, but they explain how to compile the project using commands like javac src/*.java.

我没有更改我的 NetBeans 项目的构建设置.默认情况下,如何使用 Ant 从命令行编译我的项目?一旦我构建了我的项目,编译后的文件在哪里,它是什么格式(即 .class 文件、一个 .jar 文件等)?

I haven't changed my NetBeans project's build settings. By default, how can I compile my project from the command line using Ant? Once I've built my project, where is the compiled file located, and what format is it in (i.e., .class files, one .jar file, etc.)?

(我知道询问如何使用 Ant 来编译我的项目是一个过于宽泛的问题.这就是我特别询问如何使用 NetBean 的项目默认配置进行编译的原因.)

(I understand that asking how to use Ant to compile my project in general is too broad of a question. That's why I'm specifically asking about how to compile using NetBean's default configuration for a project.)

我使用的是 NetBeans 8.0.2.

I'm using NetBeans 8.0.2.

推荐答案

ant compile 编译项目(.class 文件放在 build/classes 文件夹下)

ant compile Compiles the project (.class files are placed in the build/classes folder)

ant jar 编译项目(见上文)并构建一个 JAR(位于 dist/)

ant jar Compiles the project (see above) and builds a JAR ( located in dist/ )

如果这对您不起作用,请检查 ant 的输出是否有错误.(JAVA_HOME 变量设置是否正确?)

If that doesn't work for you, check ant's output for errors. (Is the JAVA_HOME Variable set properly?)

这篇关于使用 Ant 从命令行编译 NetBeans 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆