Reputation: 6579
I have:
fun Array<String>.main() {
println("Hello World")
}
I can compile and run it with 'java main.Main -cp [kotlin-runtime]' but in IntelliJ there isn't a 'run' button, and I cannot select this file as a main file.
It's now correctly recognized by IntelliJ since Kotlin 1.1.5.
Upvotes: 7
Views: 3435
Reputation: 6579
Oh yeah, there's only two kinds of main method can be identified by IntelliJ:
fun main(args: Array<String>) {
}
fun main(vararg args: String) {
}
Upvotes: 0
Reputation: 1894
You should use top-level main function instead
fun main(args: Array<String>) {
println("Hello World")
}
Extension function (with any name) for array doesn't work as main method
Upvotes: 10