简体   繁体   中英

Can't run Kotlin project (no Run menu)

I create Kotlin/Gradle project like this:

在此处输入图像描述

Then I create src.main.kotlin.Main.kt class with main method

在此处输入图像描述

But I cant' run it. No found menu Run in context menu

It should be like this:

class Main{
    companion object {
        @JvmStatic
        fun main(args: Array<String>) {

        }
    }
}

Another approach

fun main() {
    println("Hello World!")
}

Remove class Main in the top of file Main.kt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM