« Return to Thread: Problem with SimpleCompiler in compiling into existing class loader

Problem with SimpleCompiler in compiling into existing class loader

by Maxim Veksler-2 :: Rate this Message:

Reply to Author | View in Thread

Hello,

I'm trying to load dynamic classes into the default Classloader.

For this I'm using Janino in the following manner :

{code}
SimpleCompiler simpleCompiler = new SimpleCompiler();
ClassLoader cl = this.getClass().getClassLoader();
simpleCompiler.setParentClassLoader(cl);
simpleCompiler.cookFile(new
File("/tmp/XX/dynamicSrc/com/XX/common/dataModel/facts/dynamic/XX.java"));

// Attempt #1 - Exception.
cl.loadClass("com.XX.common.dataModel.facts.dynamic.XX");

// Attempt #2 - Exception
Object o = Class.forName("com.XX.common.dataModel.facts.dynamic.XX");
{code}

Could you please suggest what I'm doing wrong ?
Or perhaps a different solution that would allow to me to compile a
.class file from within my application. I would then copy the .class
files to a location where the Tomcat WebappClassLoader could find
them...


Help is very much appreciated.

Thank you,
Maxim.

--
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Problem with SimpleCompiler in compiling into existing class loader