How to build a jar in NetBeans 6.9?
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 i开发者_高级运维t'd be if I can build several applications (all separately runnable from command line) from one project.
I code Scala 2.8.
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.
精彩评论