Scratch file not running on IntelliJ IDEA

4.5k views Asked by At

I am trying to run a Kotlin scratch file in IntelliJ just like you would run a Java scratch file, but it doesn't work.

I created a new Kotlin scratch file, but can't run the code even after attempting the following:

  • Create a main function and print something inside.
  • Print something with println outside of the main function.
  • Create a class with a main function inside and println something.

When I create a new kotlin project, the project runs fine. The issue happens only with scratch files. I am using kotlin plugin version 1.1.51 on IntelliJ 2017.1

As the screenshot shows, the icon that allows you to run kotlin code doesn't show up on the left of the editor window:

enter image description here

1

There are 1 answers

0
zsmb13 On BEST ANSWER

Your observations are correct, and this is a known issue.