Compiling Kotlin class inside application


Currently we Kotlin extensively in our serverside application.  We want to create small scripts in Kotlin for single use task, and send them to the server to be compiled and run from our current running jvm.  How can we access the compiler? is there a way to make it use the current running classpath for compilation?  

Thank you - Matt


There's no out-of-the-box way of doing this. The compiler can be used by calling kotlin-compiler.jar classes (use at your own risk, there's no public API yet), but passing the loaded classpath is not supported, you'll need to inspect URLClassLoader's at runtime or do something similar.

If you decide to go this way, feel free to ask questions about the compiler classes