Kotlin-interactive-shell cannot execute code build with jdk11

hi there, I’m playing with ki-shell: GitHub - Kotlin/kotlin-interactive-shell: Kotlin Language Interactive Shell and trying to execute some code built by my own project. From the ki-shell, I use ‘:dependsOn xxxx.jar’ to import my own jar into the shell. Then I’m able to import my own class but when I try to execute some code, I got below error:

ERROR Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option (Line_4.kts:1:13)

I tried clone the ki source and build ki-shell with mvn -Dkotlin.version=1.6.10 -Djvm.version=11 -DskipTests package but that doesn’t seem to help.

Any help would be appreciated.

The same problem happens with Kotlin Jupyter Kernel. I think that the solution is to provide a separate artefact, that does not include JVM. It could be run on manually provided jvm.

Thanks. It’s interesting you bring up Kotlin Jupyter Kernel. This is actually my work-around of this issue for now … the same lib jar of my own project works fine in jupyter …

Putting jupyter aside, what do you mean by “provide a separate artifact, not include JVM”? Do you refer to ki-shell or my own built lib jar?


I mean that KI currently is packed together with JVM via JReleaser. It is possible to provide an artifact, that includes only libraries, not JVM. So it would be possible to use your own JVM.

As for Jupyter Kernel, see Reuse Kotlin Jupyter infrastructure to evaluated cells · Issue #112 · Kotlin/kotlin-interactive-shell · GitHub. I think the projects should be joined. The Jupyter Kernel is very well maintained (thanks to Ilya Muradyan and the rest of Kotlin for Data team). I think it makes sense to reuse some of this effort.

I see, it makes sense. I will use Kotlin Jupyter Kernel for now.