I am working on a project in which a corporate archive (ear) deployed on a JBoss server must dynamically compile (and run) the class. I use the JavaCompiler class for this - the complexity comes from the fact that the compiled class has references to some classes contained in the jjb jar in the ear.
This is not a problem when the deployed ear is “exploded” during deployment, so it is just a directory, not an archive. In this case, I can specify the desired jar in the -classpath option of the compiler, and compilation works fine. Unfortunately, due to the limitations of the systems I work with, this is not an acceptable solution for deploying these ears, and the compiler seems to be unable to “see” the required jar when it ends in the archive.
Given that dynamic compilation comes from the ear, and therefore the system class loader has access to the contents of the required jar, is there any way I can tell that the compiler just uses the classes loaded by the system class loader?
I appreciate that this is something verbose, but any help would be appreciated.
thanks
source share