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.