How to run a Scala script within IntelliJ IDEA?

前端 未结 4 1979
野的像风
野的像风 2021-02-05 02:05

Here is a trivial scala script:

object test {
  def hi() { print(\"hi there from here\") }
}


test.hi()

From the command line it does the expe

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-05 02:47

    What works for me, is:

    1. Write a Scala script, e.g. MyScript.scala
    2. In the menu select: Run -> Edit Configurations...
    3. Press the "+" (⌘N also works on the Mac in this dialog)
    4. Select "Scala Script"
    5. Then select your Script file in this dialog enter image description here

    Now you can run your script. It's a bit inconvenient, but it works.

    Note: This works for me in IntelliJ IDEA 14.x

提交回复
热议问题