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!")
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.
Adding -nc
flag saved my day.
scala -nc Hello.scala
What is -nc
?
-nc no compilation daemon: do not use the fsc offline compiler
Source: http://alvinalexander.com/java/jwarehouse/scala-2.11/compiler/scala/tools/nsc/GenericRunnerCommand.scala.shtml
What is fsc offline compiler
?
fsc – Fast offline compiler for the Scala 2 language
Source: http://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With