Pi Pi
Pi Pi

Reputation: 861

How to run scala class on IDEA

I have installed scala plugin in IDEA, set scala SDK and created a scala module.But I can only find "Compile" and "Run Scala Console" option.How can I run scala class like java? enter image description here

Upvotes: 3

Views: 5218

Answers (3)

pacman
pacman

Reputation: 837

I has similar issue, i replaced main method in class to object Main extends App {} analogue. After idea restart i could use both variant. it's trouble of intellij.

Upvotes: 0

Pi Pi
Pi Pi

Reputation: 861

It is a mistake! We should create a object which contains main to run scala application:

class Hello {

}

object Hello {
  def main(args: Array[String]) {
    println("Hello World")
  }
}

Upvotes: -1

Louis F.
Louis F.

Reputation: 2048

change class Hello to object such as described in : https://www.jetbrains.com/help/idea/2016.2/creating-and-running-your-scala-application.html

Upvotes: 2

Related Questions