classloader - Using JavaCompiler with Classpath referencing jars within ear -


i working on project in enterprise archive (ear) deployed on jboss server needs compile (and run) class dynamically. using javacompiler class - complication comes fact class being compiled has references of classes contained within ejb jar within ear.

this not problem when deployed ear 'exploded' on deployment, directory rather archive - in case able specify required jar in -classpath option of compiler, , compilation works fine. unfortunately due constraints of systems working with, not acceptable solution deploy these ears 'exploded', , compiler seems not able 'see' required jar when it's wrapped in archive.

given dynamic compilation taking place ear in question, , therefore system's class loader has access contents of required jar, there way can tell compiler use classes loaded system class loader?

i appreciate of wordy question, appreciated.

thanks

it seems there no simple way have javacompiler load dependencies of compiled code classloader. however, 1 implement javafilemanager directly , redirect operations standardlocation.class_path using resource lookups on context classloader (getresource(<class/resource name>)). withdraw limitation of standardjavafilemanager directly operating on files.

someone seems have prototypically implemented approch: http://atamur.blogspot.de/2009/10/using-built-in-javacompiler-with-custom.html


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -