How do I run a standalone Kotlin script like the o...
# scripting
j
How do I run a standalone Kotlin script like the one shown in the examples here: https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md ? I'm writing
kotlinc -cp kts.jar -script test.kts
, where
test.kts
is my script file and
kts.jar
is the
kotlin-main-kts
JAR from Maven, but I get 'Unable to find script definitions' and a bunch of errors related to it not knowing what the dependency annotations are. I'm following the tutorial as exactly as I understand it - what's missing?
g
as I remember it should be test.main.kts
because this script definition registered on this extension
but I never tried, remember some discussion
j
No change
g
Works for me with no changes, just use main.kts extension
Download jar from maven central: https://search.maven.org/artifact/org.jetbrains.kotlin/kotlin-main-kts/1.3.41/jar then just run it:
Copy code
kotlinc -cp kotlin-main-kts-1.3.41.jar  -script sample.main.kts
j
Hold up, I'm just stupid. My KotlinC version was out of date.