This content has been marked as final.
Show 1 reply
-
1. Re: how to load a class with ClassLoader outside from reposi
smilidon Jun 16, 2005 10:17 AM (in response to smilidon)i used this in my servlet, i set a new Loader(new path) with the current as parent:
URLClassLoader parentLoader = null, scriptletLoader = null;
Object currentloader = Thread.currentThread().getContextClassLoader();
if (currentloader instanceof URLClassLoader) parentLoader = (URLClassLoader)currentloader;
scriptletLoader = new URLClassLoader(new URL[]{ new URL(new File(homeDir + System.getProperty("file.separator")).toURL().toString())}, parentLoader);
Thread.currentThread().setContextClassLoader(scriptletLoader);
is that a "good" solution? can something going wrong if i set a new loader? is there a better way?
thx!