2

I have eclipse "Oxygen" version for which I have installed the kotlin plugin by referring the official kotlin site . I have also referred this page on stack overflow, but none of the methods have helped me. I am unable to see "Run as kotlin application" option. This might be a duplicate question, but the original question's answers have not helped me.

Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41
  • What steps did you perform? How would someone reproduce exactly what you've done, not what it says in the instructions, what you did? – nitind Jun 17 '18 at 16:31
  • Possible duplicate of [Unable to Run Kotlin Application in Eclipse](https://stackoverflow.com/questions/40506227/unable-to-run-kotlin-application-in-eclipse) – Alex R Oct 03 '19 at 01:13

5 Answers5

3

Remove curly braces around class and it will work :

class Hello 
fun main () {
    println("Hello World !!")
}
San
  • 31
  • 2
1

In my case, I put the main() inside the class, after putting main() at the top level it worked.

Here are the screen shots for the reference:

Correct : enter image description here

Incorrect: enter image description here

Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41
0

i don't understand why this work...

fun main() {
    println("Hola Mundo")
//  if (args.size == 0)
//      println("Te olvidaste los argumentos ...")
}

and this don't

fun main(args : List<String>) {
    println("Hola Mundo")
//  if (args.size == 0)
//      println("Te olvidaste los argumentos ...")
}

when I add parameters to main function, the menu option Run as Kotlin ... disappear!

Any Idea ?

Best Regards

Nicolas400
  • 563
  • 1
  • 7
  • 29
-1

I had to ensure the project had Kotlin Nature (go to properties -> project natures) and then open the Kotlin perspective and then i saw the run as Kotlin application.

rupweb
  • 3,052
  • 1
  • 30
  • 57
-2

Try changing the Kotlin Plugin Version. There was a bug in one of the releases. Also if that doesn't work, switch to a newer version of the IDE, maybe Photon. That should make it work.

resound
  • 21
  • 4