开发者

Scala question about examples in "Programming Scala" book

开发者 https://www.devze.com 2023-02-10 04:21 出处:网络
I\'ve been reading this free online book and I\'m hitting my head against a brick wall at the following section: -

I've been reading this free online book and I'm hitting my head against a brick wall at the following section: -

http://programming-scala.labs.oreilly.com/ch01.html#ATasteOfConcurrency

At the end it tells you to run the following commands

scalac shapes.scala shapes-actor.scala
scala -cp . shapes-actor-script.scala

Except when I run the last command I just get this error

shapes-actor-script.scala:3: error: not found: value shapes
import shapes._

At first I just typed out the code, but then figuring I may have made a typo I downloaded the code examples and it does the same there.

I'm running the latest version of Scala on Java 1.6

Any replies wo开发者_开发百科uld be appreciated.


Do this instead:

scala -cp $PWD shapes-actor-script.scala

Or maybe $PWD/. On Unix, anyway. Alternatively, try this:

scala -nocompdaemon -cp . shapes-actor-script.scala

The reason for this is that scala calls a daemon to run scripts, so any relative class paths are resolved against the directory on which the daemon was started. Tested on Scala 2.8.x, though I hope this changes in the future.

0

精彩评论

暂无评论...
验证码 换一张
取 消