2

I have the following Scala (2.10.1) script:

#!/bin/bash

export CLASSPATH=${WORKSPACE}/build/classes/main:${WORKSPACE}/build/libs/setter-for-catan.jar

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

import sfc.board.SmallBoard

and:

$ cd ${WORKSPACE}
$ find build/classes/main -name 'SmallBoard*.class'
build/classes/main/sfc/board/SmallBoard$$anonfun$1.class
build/classes/main/sfc/board/SmallBoard$$anonfun$2.class
build/classes/main/sfc/board/SmallBoard$$anonfun$3.class
build/classes/main/sfc/board/SmallBoard$$anonfun$4.class
build/classes/main/sfc/board/SmallBoard$$anonfun$5.class
build/classes/main/sfc/board/SmallBoard$$anonfun$6.class
build/classes/main/sfc/board/SmallBoard$.class
build/classes/main/sfc/board/SmallBoard.class
$ jar tvf build/libs/setter-for-catan.jar | grep SmallBoard
  1272 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$1.class
  1272 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$2.class
  1276 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$3.class
  1581 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$4.class
  1103 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$5.class
  1527 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$$anonfun$6.class
  8097 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard$.class
  3722 Sun Jun 30 20:40:54 EDT 2013 sfc/board/SmallBoard.class

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

$ ./setter-for-catan.scala 
./setter-for-catan.scala:10: error: not found: object sfc
import sfc.board.SmallBoard
       ^
one error found

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

3
  • Explain please, what does "!#" operator mean? It's hard to find in search engines. Commented Jul 1, 2013 at 13:25
  • 1
    Try to use scala -cp your-classpath. Commented Jul 1, 2013 at 13:29
  • @red1ynx, !# ends a multi-line shebang in Scala. Commented Jul 1, 2013 at 13:39

1 Answer 1

1

Use scala -cp ${CLASSPATH}, not scala -classpath ${CLASSPATH}.

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

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.