Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put external library to the JAR? [closed]

Tags:

java

I have added some external libraries to my java project (in netbeans).
Is it possible to put the external jar library to the java archive (and not to put them into a separate (for example) "lib" directory)?

like image 908
user Avatar asked Jan 09 '10 17:01

user


People also ask

How do I create a jar with an external library?

You can right-click on the project, click on export, type 'jar', choose 'Runnable JAR File Export'. There you have the option 'Extract required libraries into generated JAR'.


1 Answers

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.

like image 51
abyx Avatar answered Sep 20 '22 15:09

abyx