java - JavaCompiler API - slow compilation when running in tomcat -


my application generates java code during runtime , compiles using javacompiler api. of generated files can rather large - few hundred thousand lines. find when run javac command on generated code in command line, or alternatively if use application compilation via javacompiler api, can compile many of these files (~500), if large, in under 2 minutes. however, if call api via application when running on tomcat server, compilation time runs upwards of twelve minutes (!!!).

i appreciate suggestions on how improve performance of compilation.

thanks!

try set thread priority highest value (on thread or thread pool):

setpriority(thread.max_priority); 

Comments