Alexei
Alexei

Reputation: 15716

Can't run Kotlin project (no Run menu)

I create Kotlin/Gradle project like this:

enter image description here

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

enter image description here

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

Upvotes: 0

Views: 127

Answers (2)

Alexei
Alexei

Reputation: 15716

Another approach

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

Remove class Main in the top of file Main.kt

Upvotes: 0

Daniel Jacob
Daniel Jacob

Reputation: 1546

It should be like this:

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

        }
    }
}

Upvotes: 1

Related Questions