Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
anchit pancholi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
anchit pancholi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18164
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
anchit pancholi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic