Loading the Jar Files using Custom Class Loaders
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ravi_Kumar
Posted On:   Thursday, April 4, 2002 03:54 AM

I have a set of Jar files, which i want to load using a Custom class loader. I want to load each & every class inside the each jar files. I have tried to using URLClass Loader in such a way: URL[] urlList = new URL[1]; urlList[0]=new File("c:sampleFirstJar.jar").toURL(); urlList[1]= new File("c:sampleSecondJar.jar").toURL(); URLClassLoader urlLoader = new URLClassLoader(urlList); urlLoader.loadClass("com.sun.Customer"); I am getting a Null Pointer Exception in loadClass() Method. Is this is correct way to load all jar files in the JVM using Class Loaders? If not provide me the   More>>


I have a set of Jar files, which i want to load using a Custom class loader. I want to load each & every class inside the each jar files. I have tried to using URLClass Loader in such a way:




URL[] urlList = new URL[1];

urlList[0]=new File("c:sampleFirstJar.jar").toURL();

urlList[1]= new File("c:sampleSecondJar.jar").toURL();

URLClassLoader urlLoader = new URLClassLoader(urlList);

urlLoader.loadClass("com.sun.Customer");

I am getting a Null Pointer Exception in loadClass() Method.



Is this is correct way to load all jar files in the JVM using Class Loaders? If not provide me the source code?

   <<Less
About | Sitemap | Contact