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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With