Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile NetBeans project from command line by using Ant

Tags:

java

ant

netbeans

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.

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.)?

(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.)

I'm using NetBeans 8.0.2.

like image 323
Kevin Avatar asked May 02 '15 21:05

Kevin


People also ask

What is ant in NetBeans?

Today Ant is the build tool of choice for a lot of projects, and it is the default build tool in NetBeans IDE (version 8.2 and older).


1 Answers

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

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

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

like image 104
Spycrab0 Avatar answered Oct 13 '22 09:10

Spycrab0