12

I created a kotlin new Kotlin project through intelliJ (https://github.com/dhananjay12/kotlin/tree/master/kotlin-basic) a while back. I then imported it into IntelliJ from a different machine.

There is no run option coming : enter image description here

I tried to configure using Project SDK and Libraries, still, IntelliJ doesn't recognize it as a kotlin project. enter image description here

enter image description here

NOTE- New project works completely fine

How do I configure an existing project to Kotlin?

What files need to be saved in git so that manually configuring IDE is not required?

Dhananjay
  • 1,140
  • 1
  • 12
  • 28
  • Those files have main method, just right click on it and run the file. – abitcode Oct 24 '18 at 05:27
  • As you can see from the first image, there is no run option coming. : ( – Dhananjay Oct 24 '18 at 05:29
  • Do you have the Kotlin plugin installed? I think it should come with current versions of IntelliJ now, but it's worth checking in Settings. – zsmb13 Oct 24 '18 at 05:40
  • Yes, Kotlin plugin is installed. As I mentioned, new Kotlin projects works fine. I am struggling with importing existing project into intelliJ – Dhananjay Oct 24 '18 at 05:42

1 Answers1

29

1) Right click the src folder

2) Mark directory as Sources Root

3) Will ask you to configure Java SDK and Kotlin Plugin for the module. Do it.

4) Run & enjoy

abitcode
  • 1,420
  • 17
  • 24