问题
I use Tomcat 6.0.20 and JDK 1.6.0.13.
How can I load libraries from sub-folders of "%TOMCAT_HOME%/lib/" without taking the .jars out of sub-folders and putting them straight into "%TOMCAT_HOME%/lib/"?
The reason I want to do this, is because many apps are going to be sharing lots of libraries.
So, for the sakes of organization I want to store them into folders as such:
%TOMCAT_HOME%/lib/novell/.jar
%TOMCAT_HOME%/lib/mail/.jar
%TOMCAT_HOME%/lib/upload/*.jar
etc.
How would I go about this? And please provide an example. Do I use setclasspath.bat, catalina.properties or something completely different? Thanks in advance.
回答1:
Define those paths in shared.loader
property of /conf/catalina.properties
file.
E.g.
shared.loader = ${catalina.home}/lib/novell/*.jar, ${catalina.home}/lib/mail/*.jar, ${catalina.home}/lib/upload/*.jar
[Edit] optionally you can also use the common.loader
property for this. See what has your preference.
来源:https://stackoverflow.com/questions/1675255/how-to-manage-tomcat-6-libraries-into-subfolders-under-tomcat-home-lib