How to call main function from Interpreter Scala REPL
Following the information in
Scalaプログラミング入門
以下のサンプルコードを実行するとすると。
1: object Hello { 2: def main(args: Array[String]) { 3: println("Hello Kobe!") 4: } 5: }
REPL を起動して、以下を実行。
# 私の場合、emacs のScalaモードでREPLを起動している。
scala> :load Hello.scala Loading Hello.scala... defined module Hello scala> Hello.main(Array()) Hello Kobe!