Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from kotlin source to java execution of the generated bytecode

Write the simplest Kotlin file, and name it Main.kt:

fun main(args: Array<String>) {
    println("Hello world!")
}

Then compile the Kotlin file with kotlinc, which runs the Kotlin compiler

❯ kotlinc Main.kt

Then run the generated MainKt.class bytecode with

❯ java -cp ~/.sdkman/candidates/kotlin/current/lib/kotlin-stdlib.jar:.  MainKt

(where ~/.sdkman/candidates/kotlin/current/lib/ is my actual path to the Kotlin lib folder).

And you'll get:

Hello world!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.