Is it possible to debug Kotlin JVM code from the command line? I have not figured out a way to do this outside of IntelliJ IDEA.
The java debugger is language agnostic. As long as the sourcecode has lines and the debug information is present in the class file the debugger can use it. There is however one issue in that Kotlin uses synthetic line numbers for inline code (from other files) as the jvm only allows a single source file for a class file.
When running JDB on a basic Kotlin “Hello world” application, I get the following output:
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.lang.ClassLoader.loadClass(), line=436 bci=121
This is the source code:
fun main(args: Array<String>) {
println("Hello world")
}
You will have to add the Kotlin standard library to the classpath.