• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Organizing jar files into folders within lib

 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic