how to run compiled class file in Kotlin?

后端 未结 5 663
花落未央
花落未央 2020-12-01 16:03

Jetbrains provides some documentation but I can\'t find how to run compiled class file of Kotlin.

hello.kt:

fun main(args : Array) {
           


        
5条回答
  •  猫巷女王i
    2020-12-01 16:19

    We ran into the same program and blogged our solution here: http://blog.ocheyedan.net/blog/2012/02/19/running-kotlin-code/

    Basically you just need to invoke java with the -cp and the main class of 'namespace'. From your question, the java invocation would look something like this:

    java -cp /usr/local/kotlin/lib/kotlin-runtime.jar:dist/namespace.class namespace
    

提交回复
热议问题