wood burning stoves 2.0*
The moose likes Servlets and the fly likes who to load .jar files of subfolder in lib folder? 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 » Java » Servlets
Bookmark "who to load .jar files of subfolder in lib folder?" Watch "who to load .jar files of subfolder in lib folder?" New topic
Author

who to load .jar files of subfolder in lib folder?

anchit pancholi
Ranch Hand

Joined: Oct 14, 2010
Posts: 53
in webapps\myappliction\WEB-INF\lib\myfolder

and in myfolder have some .jar will that all jar will automatic loaded when server run???

or anything suggest me how to load all jar which are in subfolder of lib

or it can be loaded directly no need to put any extra efforts ???

thanks in advence
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

You would not require any process to load the jar files which are placed in /WEB-INF/lib directory. Automatically it will be loaded by your web/app server since /WEB-INF would be added in the classpath of the web application. The server does all things for you.


No pain, No gain.
OCJP 1.6
anchit pancholi
Ranch Hand

Joined: Oct 14, 2010
Posts: 53
Kumaravadivel Subramani wrote:You would not require any process to load the jar files which are placed in /WEB-INF/lib directory. Automatically it will be loaded by your web/app server since /WEB-INF would be added in the classpath of the web application. The server does all things for you.


you didnt get me i am talking about "subfolder of lib"
like :-
WEB-INF >> lib >> myfolder >> all my .jar files are here

thanks for reply
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

1. You do not "load" jars. Jars are containers for classes. Classes are loaded at need from the jars and directories in the classpath.

2. The fact that the webapp is in "webapps" doesn't matter. In J2EE, each application effectively has its own resource filesystem, rooted at the root of the WAR. Where the WAR is located doesn't matter, as long as the appserver knows where it is. And, for that matter, the "backslash" character isn't really appropriate here, even under Windows. Use the forward slash. It's safer and more portable.

3. When a WAR is deployed, the /WEB-INF/classes and all the jars in /WEB-INF/lib are added to its classpath. The only way to have alternative locations for classes such as subdirectories of /WEB-INF/lib, or JARs inside of /WEB-INF/LIB jars is to create a custom classloader that knows about such constructs and can open them up and return the classes inside them.


Customer surveys are for companies who didn't pay proper attention to begin with.
anchit pancholi
Ranch Hand

Joined: Oct 14, 2010
Posts: 53
Tim Holloway wrote:1. You do not "load" jars. Jars are containers for classes. Classes are loaded at need from the jars and directories in the classpath.

2. The fact that the webapp is in "webapps" doesn't matter. In J2EE, each application effectively has its own resource filesystem, rooted at the root of the WAR. Where the WAR is located doesn't matter, as long as the appserver knows where it is. And, for that matter, the "backslash" character isn't really appropriate here, even under Windows. Use the forward slash. It's safer and more portable.

3. When a WAR is deployed, the /WEB-INF/classes and all the jars in /WEB-INF/lib are added to its classpath. The only way to have alternative locations for classes such as subdirectories of /WEB-INF/lib, or JARs inside of /WEB-INF/LIB jars is to create a custom classloader that knows about such constructs and can open them up and return the classes inside them.



thanks of reply tim

i have one more question

can i make custom classloader application specific ....because in my application have some complication there classes are conflict with each other
so i want to make like particular classes will load with particular application only

thanks for reply tim
 
 
subject: who to load .jar files of subfolder in lib folder?
 
Similar Threads
Sub directory in web-inf/lib
packing java file into JAr file
JSF with Weblogic 8.1 sp3
who to load subfolder of lib ????
Proper use of /shared/lib