Vivek
Vivek

Reputation: 2101

Including dependant Jar's inside a single JAR

I have got a JAR file which contains Utility classes, that are used in my Web Application.

Now some of the Utility classes require their respective libraries such as commons-logging, db2java.

But my final Utility JAR being packaged does not contain these required libraries , I tried including them but they are not picked up by the classes.

Can anybody tell me as to how can I include these dependant libraries inside my Utility JAR in such a way that my classes pick them and execute properly.

Upvotes: 2

Views: 236

Answers (2)

Brad
Brad

Reputation: 15909

Just put all the lib's in your WEB-INF/lib folder and not try to bundle them into one JAR file. Having your libs broken out into their own JAR files is easier to manage.

WEB-INF/lib/
....commons-lang-3.0.jar
....db2java-1.0.jar
....my-utilities-1.0.jar

You can also see the versions of the jars (in case you want to update one) without having to go digging around for them

Upvotes: 5

Jyro117
Jyro117

Reputation: 4529

If you are interested in a way to store all of the dependent jar files inside of a single jar, I would recommend using the fatjar plugin. It does exactly what you are asking for. I've used it many times for quick deployment with web applets, and desktop apps.

Upvotes: 2

Related Questions