1

I have the following Scala (2.10.1) script:

#!/bin/bash

export CLASSPATH=${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar

exec ${SCALA_HOME}/bin/scala -cp ${CLASSPATH} "$0" "$@" 2>&1
!#

import play.api.libs.json.JsArray

and:

$ jar tvf ${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar | grep JsArray
  1401 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$$anonfun$$bslash$bslash$1.class
  2234 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$.class
  1517 Sat Jun 29 18:33:38 EDT 2013 play/api/libs/json/Reads$JsArrayMonoid$.class
  8358 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray.class
  1368 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/JsArray$$anonfun$apply$1.class
  6035 Sat Jun 29 18:33:36 EDT 2013 play/api/libs/json/DefaultReads$JsArrayReads$.class

yet the script isn't finding the play package much less the class:

$ ./setter-for-catan.scala
./setter-for-catan.scala:12: error: not found: object play
import play.api.libs.json.JsArray
       ^

one error found

What's going on and what needs to be done to fix it?

4

2 回答 2

1

编译器守护程序可能处于时髦状态。尝试fsc -shutdown重置它。

于 2013-07-04T00:40:03.933 回答
0

我不知道为什么,但以下解决了这个问题:

#!/bin/bash

export CLASSPATH=${WORKSPACE}/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar
classpath="${CLASSPATH}"
unset CLASSPATH

exec ${SCALA_HOME}/bin/scala -cp "${classpath}" "$0" "$@" 2>&1
!#

import play.api.libs.json.JsArray
于 2013-07-01T19:22:26.157 回答