Running scripts with certain classpath

I need to compile and run a bunch of Kotlin script files (.kts) with certain classpath (JAR file, for example). It seems it is impossible with plain ScriptEngine, but I don’t understand what I should use.