Kotlin 1.4.21 - where is kotlin-runtime.jar

Just making first step into Kotlin. Running on Win10 with Java 8.
Tried the CL compiler - downloaded and unzipped kotlin-compiler-1.4.21.zip from GitHub.
Added ‘kotlinc\bin’ to path. Compiler creates .class file and I can run ‘kotlin HelloKt’.
But not ‘java HelloKt’ - getting ‘java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics’
OK so online tutorial says need ‘kotlin-runtime.jar’ in classpath.
Except that there is no such JAR in ‘lib’ folder.
I can run this:
java -cp .;D:\work\kotlinc\lib\kotlin-runner.jar HelloKt
but that is different JAR.
Any ideas?

You should include kotlin-stdlib.jar in the classpath for java. It should be in the lib directory.
You can also pass the -include-runtime argument to kotlinc, this will instruct it to merge the standard library jar in the resulting jar file.

What tutorial do you use by the way? Is it from kotlinlang.org? Probably it’s out of date and should be actualized.

3 Likes

Thanks for reply - I was following Hadi Hariri’s “Introduction To Kotlin Programming” on O’Reilly’s website. It is very likely somewhat out of date since since it was published in 2016. His IntelliJ examples cannot be followed verbatim either since UI changed.

1 Like