That would do the work but you would end up compiling the source everytime andcreating two extra processes when you run it.Using JNI to create the JVM and then executing your previously compiled classis the way to go IMHO.