Compiling kotlin code without a script


I am trying to compile kotlin code as a string argument in java. But I couldn’t find any compile function to do so.

There isn’t one. Setting up the Kotlin compiler is fairly complicated, and at this time it’s not encapsulated into a single function that you can call.

Thanks Yole. Also I have another question. Should I create a new message for it?

actually im using the compiler to generate classes at runtime.
you add
compile ("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion")
to your build file and call

                "-d", targetJar))```
but it means u have to write your code into a file, cant give it as a string.