JetBrains / kotlin-netbeans

Kotlin Plugin for NetBeans https://kotlinlang.org
Other
95 stars 26 forks source link

"Run file" not working #125

Open ghost opened 6 years ago

ghost commented 6 years ago

The following Kotlin class:

class Hello {

    fun main(args : Array<String>) {
        System.out.println("Hello, Kotlin")
    }
}

Can't be run using NetBeans' "Run file" option. The menu item is disabled.

grafik This is also true for the main menu item and the context menu inside the project explorer.

Using: NetBeans IDE 8.2 (Build 201609300101) Plugin version: 0.2.0.1 (https://github.com/JetBrains/kotlin-netbeans/releases/download/v0.2.0.1/kotlin.netbeans.plugin-0.2.0-SNAPSHOT.nbm)

This is a Java/Maven project

SerVB commented 6 years ago

@devtomk I think you can't run this class anyway because the main function isn't static.

The idiomatic way would be a free-standing function (outside of a class).

Check the source here: https://discuss.kotlinlang.org/t/no-class-just-fun-main/5147/4.