【发布时间】:2011-03-22 17:35:23
【问题描述】:
我刚刚在 osx 上通过 macports 安装了 scala
sudo 端口安装 scala28
我创建了一个名为 test.scala 的简单脚本
println("hello world")
当我通过它运行时
scala test.scala
我收到以下错误:
scala test.scala
error: fatal error: object scala not found.
one error found
有什么想法吗?
** 更新 ** 从 REPL 运行会产生正确的结果,但仍然无法直接使用“scala”
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load ./test.scala
Loading ./test.scala...
hi there sir
scala>
** 更新最终 **
当我执行 ps -ef | grep 斯卡拉 我有几个 scala 编译服务器正在运行,当我关闭它们并重新运行我的脚本时,一切都恢复了。一定是状态不好。
【问题讨论】:
-
这听起来像是一个类路径问题。当您尝试使用
scalac编译某些内容时会发生什么? -
好吧,为什么不接受答案呢?它对我来说效果很好......
标签: scala