views:

68

answers:

1

When I press "build project" it NetBeans builds, as far as I could find, separate class files. How can I set it to build them into a jar file? Even better it'd be if I can build several applications (all separately runnable from command line) from one project.

I code Scala 2.8.

+2  A: 

Using the Run > Clean and Build Main Project command in NetBeans puts your program's JAR in a folder named dist located at the root level of the project; any associated libraries go in dist/lib. As discussed here, a JAR's manifest may have only one Main-Class attribute, but the JAR itself may have an arbitrary number of classes that declare a main() method.

Addendum: Here is a concrete example using H2 Database.

$ java -cp h2.jar org.h2.tools/Console -help
$ java -cp h2.jar org.h2.tools/Server -help
$ java -cp h2.jar org.h2.tools/Shell -help

Addendum: External libraries are often added via the Library Manager.

trashgod
Doesn't NetBeans use maven ? In this case, wouldn't the result be in the target folder ?
Colin Hebert
@Colin HEBERT: `maven` is one way NetBeans supports locating external dependencies; I added a link to a picture of the Library Manager above.
trashgod