runtime-compilation

On-the-fly, in-memory java code compilation for Java 5 and Java 6

佐手、 提交于 2019-11-26 07:37:21
问题 How can I compile java code from an arbitrary string (in memory) in Java 5 and Java 6, load it and run a specific method on it (predefined)? Before you flame this, I looked over existing implementations: Most rely on Java 6 Compiler API. Those that don\'t, rely on tricks. Yes, I checked out commons-jci. Either I\'m too dense to understand how it works, or it just doesn\'t. I could not find how to feed the compiler my current class path (which is quite huge). On the implementation that worked