Is there a way to pass a classloader to the script...
# scripting
s
Is there a way to pass a classloader to the script execution? I noticed there is such a field in the configuration, but I don't know how to access it
i
You need to pass it in the evaluation configuration, e.g. like it is done here - https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-main-kts-test/test/org/jetbrains/kotlin/mainKts/test/mainKtsTest.kt#L24 (here it is set to
null
to evaluate scripts in an isolated classloader, but you can use any classloader here.) By default, as you seems already discovered, thread context classloader is used as a base.