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?

2
  • I don't see any errors in what you've written, and it works perfectly fine for me. However, if given an improper WORKSPACE path (or the path to the JAR just isn't correct), then it would report that it cannot find "object play". Commented Jul 1, 2013 at 16:00
  • @James, my script actually has a hard-coded path and doesn't use WORKSPACE. Also, I have some Scala files that compile fine against the Play jar. Commented Jul 1, 2013 at 18:13

2 Answers 2

1

The compiler daemon may be in a funky state. Try fsc -shutdown to reset it.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure why, but the following works around the problem:

#!/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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.