Put external library to the JAR? [closed]

Of course you can. There are a few open source projects that can be downloaded with a "bundle jar" that contains all the dependencies.
You need to extract all the jars and then jar them again to one file.
An example of doing this with Ant can be seen here.


The JarJar project allows you to package depend jars into a single jar file for distribution.

The project provides an ant task to do the packaging and as netbeans projects use Ant for their build process, you should be able to integrate it into your build fairly easily.


Yes, this is possible and the resulting jar is actually called an "uberjar" or "megajar". Basically, to create an "uberjar", you'll need to extract the content of the external library (using jar -x) and to repack it in your own jar (with jar -c). This can be achieved by hand, or with a build tool like Ant (and the optional support of a project like One-JAR) or Maven which has built-in support for this through the maven-assembly-plugin (or the maven-shade-plugin)