javax.tools.JavaCompiler ClassLoader question
843810Apr 19 2007 — edited Feb 23 2010Hi
I am using the brand new javax.tools.JavaCompiler feature to compile on the fly some source code. However using the library under web start becomes cery tricky.
1) The compiler tries to read the java.endorsed.dirs system property and it fails. The only solution I have found so far is to grant all permission on the client javaws.policy file (which is the more than bad solution. I have posted a thread here too: http://forum.java.sun.com/thread.jspa?messageID=9620391 )
2) If I solve problem 1, then the compilation fails again because the new class I am creating implements an Interface which is normally found in the class path. However that is no more true on web start since application jars are loaded by a custom class loader, and the JavaCompiler (even though called from within the classloader who knows the required interface) is not able to find the interface.
Now the question is: is there a reason why JavaCompiler uses a class loader whose parent is not taken from the instantiating method but rather the system class loader is used directly? Or is there something I am missing?
Thanks
Vito Impagliazzo