为什么我不能执行scala文件? [英] Why I can't execute scala file?
问题描述
我是Scala的新手,第一次运行Scala,我在安装Scala的时候,创建了一个名为Hello.scala
的文件,内容是:
I am a newbie to Scala, it's the first time I'm running Scala, when I installed Scala, I created a file named Hello.scala
, the content is:
println("HelloWorld!")
当我输入scala
时,没有问题,显示的是scala REPL,但是当我输入scala Hello.scala
时,提示:
when I typed scala
, there was no problem, the scala REPL was shown, but when I typed scala Hello.scala
, it prompted:
<console>:1: error: ';' expected but '.' is found.
我不知道是什么问题,希望有人能帮助我.
I dont know what problem is, I hope someone can help me.
推荐答案
添加
-nc
标志拯救了我的一天.Adding
-nc
flag saved my day.scala -nc Hello.scala
什么是
-nc
?-nc no compiler daemon:不使用fsc离线编译器
什么是
fsc离线编译器
?fsc – Scala 2 语言的快速离线编译器
来源:http://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html
这篇关于为什么我不能执行scala文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!