Skip to Main Content

URLClassLoader in web app- add external jar to the web app classpath

811814Aug 17 2011 — edited Sep 9 2011
Hi all,

I have a query for u guys, I'm using a jar parser code in my web application. This jar parser method uses URLClassLoader to parse the jar and loads the classes of a jar. After the class is loaded it is checked whether its an instance of other preloaded class B(this class jar is in lib).

For ex: Class classss = cl.loadClass(com.A); // Class A inherits Class B

Object obj = classss.newInstance();

boolean val = ojb instanceOf B

So the value of val should be true, but its false because its missing the jar file(Class B) in the classpath.

So anyone have any idea about how to add external jar to the web application jar.

Ur help is much appreciated.

Thanks in advance,
Bachchu
Comments
Post Details
Added on Aug 17 2011
3 comments
176 views