URLClassLoader won't load my class!
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Paul_Hunnisett
Posted On:   Friday, May 10, 2002 02:48 AM

I am trying to write some code to load up a class at runtime(DefaultServlet.class).

I have opted to use a URLClassLoader to do this and have written the following code:

URLClassLoader loader = new URLClassLoader(classpath);

Servlet currentServlet = (Servlet)loader.loadClass(DefaultServlet).newInstance();

classpath is an array of URLs. DefaultServlet.class is definately at the specified URL (I have done checks to make sure that the URL points to where I think it does), however I still get a ClassNotFoundException.

Any ideas anyone?

About | Sitemap | Contact