Kotlin.io not available in script executed via JSR-223?

I’ve configured the JSR-223 embedding and been able to run simple scripts. But the following script was surprising:

System.err.println("Hello from SLIME Kotlin!")
System.err.println("bindings.message = ${bindings["message"]}")
System.err.println("kotlin.Any() = " + kotlin.Any())

This produces the expected output for the first three lines, but the fourth line fails with:
Wrapped javax.script.ScriptException: error: unresolved reference: io kotlin.io.println("foo")

(println by itself doesn’t work either.)

Is there some quirk of my embedding that could explain this, or is this a bug?

I had to build my own kotlin.script.classpath in this environment, for example, and I might not have it right for all cases. It currently includes:


Those JARs are also loaded into the JSR-223-invoking ClassLoader. The default JSR-223 instantiation method is not used; the Kotlin JSR223 factory is instantiated via its constructor.

Sorry for the delayed answer.
You need to have kotlin-stdlib in the classpath as well.
BTW, the upcoming Kotlin 1.3.40 will include the new kotlin-scripting-jsr223 jar, that hopefully will be easier to use for embedding.