How to run scala main file

Answered

I have installed Scala plugin and sbt executer in IntelliJ.
I have created a new Scala project and it created a build.sbt file.
In the project setting/Libraries I see a reference to the SBT I have on my computer.
I created a new Scala class with the following code:

class RunMe {
 def main(args: Array[String]): Unit = {
    println("Hello from main of class")
  }
}

I can't seem to find a new type of run configuration to create for the scala class.
I don't see the green play button in the left column (IntelliJ Left Gutter) What am I missing?

How can I configure a run configuration in the code?

https://i.imgur.com/WhjlxF5.png
https://i.imgur.com/yRbKPPo.png

1 comment
Comment actions Permalink

Try making your application an object instead of a class, e.g.:

object RunMe {
 def main(args: Array[String]): Unit = {
    println("Hello from main of class")
  }
}

or

object RunMe extends App {
  println("Hello from main of class")
}
0

Please sign in to leave a comment.