This is specific test for JSR223 host in IntelliJ IDEA. You need to have an infrastructure to make it run. Generic JSR 223 examples are located here: kotlin/libraries/examples at master · JetBrains/kotlin · GitHub (kotlin-jsr223-*) and the “kotlin-jsr223-local-example” is easiest to follow and reuse.
Doubt the OP cares any more but for future searchers, the key steps to get it to work are:
You need these libraries in your class path (in additon to stdlib):
kotlin-compiler
kotlin-script-util
In addition, you need a META-INF/services/javax.script.ScriptEngineFactory file in the classpath jar to tell the JSR223 script engine to use the Kotlin script engine. Just adding the above libraries does not do it (probably a security concern). The easiest way to just add the file to your own jar like from this example: