I have java code snippets dynamically generated which refer back to classes with public apis in the tomcat classpath. I am able to correctly identify the public apis (methods) of these classes thru reflection, but then after using this information to generate my java code I was to compile it with the Java Compiler API.
Is this possible? Do I need to get the classpath that tomcat has used to load my servlet somehow and pass it to the Java Compiler API?
Andy
You will have to pass the classpath.. This code does the classpath retrieve stuff
You pass the options to the compiler.getTask
CompilationTask task = compiler.getTask(writer, memoryManager, diagnostics, options, classes, compilationUnits);