I'm trying to get the reflection lib included in sample jar, but can't get it to work:
$ kotlinc hello.kt -d hello.jar
$ java -jar hello.jar
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
The runtime lib was missing, so let's add it:
$ kotlinc hello.kt -include-runtime -d hello.jar
$ java -jar hello.jar
Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
Now the runtime lib is included, but the reflection lib is missing, so let's specify kotlin home directory:
$ kotlinc hello.kt -include-runtime -kotlin-home ~/.sdkman/candidates/kotlin/1.1.1 -d hello.jar
$ java -jar hello.jar
Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
Reflection lib is still not included. kotlinc
help lists a '-no-reflect
' option, so I'm assuming the reflection library should be included by default when '-include-runtime
' is set, but this doesn't seem to be the case.