今天测试《scala 编程》书中的脚本,发现不能执行,
[zhangwt@centos66 scala-file]$ cat hello.scala
println("Hello,world,from a script!")
直接$scala hello.scala,没有任何结果$scalac hello.scala提示println这行有错误,百思不得其解.
搜了半天发现了这篇文章“Scala可以在交互模式下运行但无法执行脚本的解决方法http://blog.youkuaiyun.com/hiarcs/article/details/6229913”
在/etc/hosts文件里面增加了本机名称,果然解决了,但不知道啥原因,实在是奇葩的很,。
$cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
centos66::1 localhost localhost.localdomain localhost6 localhost6.localdomain6