Scala script tool seems to be broken Fedora 17

· Read in about 1 min · (203 Words)

I am running Scala on Fedora 17 and I seem to face a problem. I created a /tmp/hello.scala file, as follows:

println("Hello world")

This works just fine if I run it on Ubuntu 12.04 i.e. it prints Hello world. However, when I try to run it on Fedora, I don’t get any output and the script keeps waiting forever.

So I tried to inspect what’s happening here:

$ bash -x scala /tmp/hello.scala
+ scala_exit_status=127
+ saved_stty=
+ trap onExit INT
++ stty -g
+ saved_stty=6d02:5:4bf:8a3b:3:1c:7f:15:4:0:1:ff:11:13:1a:ff:12:f:17:16:ff:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
+ [[ ! -n 0 ]]
+ [[ -n '' ]]
+ cygwin=false
+ case "`uname`" in
++ uname

... OUTUPT SKIPPED ...

+ declare -a scala_args
+ CPSELECT=-Xbootclasspath/a:
+ '[' 1 -gt 0 ']'
+ case "$1" in
+ scala_args=("${scala_args[@]}" "$1")
+ shift
+ '[' 0 -gt 0 ']'
+ set -- /tmp/2.scala
+ exec /usr/lib/jvm/java//bin/java -Xmx256M -Xms32M -Xbootclasspath/a:/usr/share/scala/lib/jansi.jar:/usr/share/scala/lib/jline2.jar:/usr/share/scala/lib/scala-compiler.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scalap.jar:/usr/share/scala/lib/scala-swing.jar -Dscala.usejavacp=true -Dscala.home=/usr/share/scala -Denv.emacs= scala.tools.nsc.MainGenericRunner /tmp/2.scala

It keeps waiting on the last line for ever.

However, if I add -nc option to scala command, it works fine:

$ scala -nc /tmp/hello.scala
Hello world

So I guess, the issue has something to do with the compilation daemon as below

-nc no compilation daemon: do not use the fsc offline compiler