Help. I am starting out learning Scala. My programs run fine on my Windows PC, but anytime I try to run a program on my Linux box (ibmp2), the output is just the hostname printed twice. See example below. What's wrong?
[sean@ibmp2 ~]$ cat hello.scala val oneTwo = List(1, 2) 开发者_JAVA技巧val threeFour = List(3, 4) val oneTwoThreeFour = oneTwo ::: threeFour println(""+ oneTwo +" and "+ threeFour +" were not mutated.") println("Thus, "+ oneTwoThreeFour +" is a new list.") [sean@ibmp2 ~]$ scala hello.scala ibmp2: ibmp2 [sean@ibmp2 ~]$ which scala /usr/local/scala-2.8.1.final/bin/scala [sean@ibmp2 ~]$ scala Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_17). Type in expressions to have them evaluated. Type :help for more information. scala> println("hello") hello scala>
While I haven't run into it with Scala specifically, I have encountered issues with running networking-related Java programs on CentOS/Fedora where the root cause turned out to be that localhost
was not resolved in a reverse lookup query somewhere in INetAddress.java (or something, it's been a while since I looked into it.) So, two suggestions:
1) Ensure that Scala is not trying to fire up fsc in the background and connect to it by using scala -nocompdaemon
instead of just scala
2) Edit your hosts file (sudoedit /etc/hosts
) and make sure localhost and your machine's custom name are both specified therein.
I'm just guessing, but these might resolve the issue.
To me this looks like you are not executing, what you think you are.
Try using the full path when calling scala.
精彩评论