IntelliJ不打印scala hello word?

时间:2017-04-04 15:32:04

标签: scala intellij-idea

我安装了IntelliJ和scala。我创建了一个Scala控制台程序。

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

但是,单击“运行”菜单项后,它没有显示任何内容。

"C:\Program Files (x86)\Java\jdk1.8.0_121\bin\java" -Djline.terminal=NONE "-javaagent:C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\lib\idea_rt.jar=42884:C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\scala\lib\scala-compiler.jar;C:\Program Files (x86)\scala\lib\scala-library.jar;C:\Program Files (x86)\scala\lib\scala-reflect.jar;C:\Users\....\.IdeaIC2017.1\config\plugins\Scala\lib\scala-plugin-runners.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_121\jre\lib\rt.jar;C:\Program Files (x86)\scala\lib\scala-parser-combinators_2.12-1.0.4.jar;C:\Program Files (x86)\scala\lib\scala-swing_2.12-2.0.0-M2.jar;C:\Program Files (x86)\scala\lib\scala-xml_2.12-1.0.6.jar" org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner -usejavacp
Welcome to Scala 2.12.1 (Java HotSpot(TM) Client VM, Java 1.8.0_121).
Type in expressions for evaluation. Or try :help.

scala> 

1 个答案:

答案 0 :(得分:1)

您运行的是scala控制台,而不是您的脚本。别忘了为intelliJ安装scala插件。

以下是如何安装它的说明:https://www.jetbrains.com/help/idea/2017.1/creating-and-running-your-scala-application.html