File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Organizing jar files into folders within lib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Organizing jar files into folders within lib" Watch "Organizing jar files into folders within lib" New topic
Author

Organizing jar files into folders within lib

John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
My web app is starting to contain a lot of jar files, I would like to add sub directories in the lib folder for my web app. However i am unsure of how to configure the class loader for my app so it reads the sub directories.

I read this: http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

but i am unclear on how to create the entry so it is per webapp. I am also not sure on how to define the path to my lib directory so I can add the sub directories to the path.

Has anyone done this before?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

No. It seems like a waste of time to me. Just dump all the jars into the lib during the automated build and who cares if they're structured or not.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Schretz
Ranch Hand

Joined: Sep 10, 2008
Posts: 188
Bear Bibeault wrote:No. It seems like a waste of time to me. Just dump all the jars into the lib during the automated build and who cares if they're structured or not.


I do agree, i guess its more for my sanity. I have a habit of trying out new jars, then choosing to not use them and leaving them behind. Wouldn't want to bloat the app with jars not being used.
For now i just created a text file with a list of jars that belong to each other and what they are used for. Only thing is I have to now maintain it. I was able to at leas get rid of old jars when i created the list.
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Not sure about Tomcat but in JBoss you can tell it in jboss-service.xml where to look for jars..

For instance:


this allows us to put jars and property files in the conf folder without affecting the war.

WP
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2274
    
  28

John Schretz wrote:
Bear Bibeault wrote:No. It seems like a waste of time to me. Just dump all the jars into the lib during the automated build and who cares if they're structured or not.


I do agree, i guess its more for my sanity. I have a habit of trying out new jars, then choosing to not use them and leaving them behind. Wouldn't want to bloat the app with jars not being used.
For now i just created a text file with a list of jars that belong to each other and what they are used for. Only thing is I have to now maintain it. I was able to at leas get rid of old jars when i created the list.


So, you are having managing the jars that are the dependencies of the jars that you use?

It might help if you use maven as your build tool. In maven, you specify only the jars that you are dependent on. It automatically finds out the dependencies' dependencies and downloads them. That way, once you stop using a lib, just remove it from your build file, and it will automatically stop using it (and it's dependencies).
 
wood burning stoves
 
subject: Organizing jar files into folders within lib
 
Similar Threads
ERRORgetProxyFactory, CGLIB Enhancement failed:
using hibernate in J2EE app
class loading issue in Jboss
log4j setting in enterprise project structure
JBoss class loading and reading .properties files