From a script, how to make a call to a class with package name?

15 views
Skip to first unread message

Daniel Jin

unread,
Oct 6, 2015, 9:34:52 AM10/6/15
to scala-user
With -classpath both in the myTest.scala file or outside when I call "scala -classpath ./TestObject.jar myTest.scala", I always get this error:

myTest.scala:6: error: not found: value test
import test.mypackage.TestObject
       ^
myTest.scala:8: error: not found: value TestObject
TestObject.printCurrentDate()
^
two errors found

Any ideal how do I import classpath jar file properly?

myTest.scala
TestObject.scala
TestObject.jar

som-snytt

unread,
Oct 6, 2015, 12:59:54 PM10/6/15
to scala-user

If you run scala to compile scripts, it starts a compile daemon. It's called a daemon because it is evil; although classically, daemons are not demons per se.

You can exit a running daemon with fsc -shutdown or similar.

Best practice is maybe while working on the script, use scala -nc to turn off the compile daemon.

The server isn't seeing your new package, I'd guess.
Reply all
Reply to author
Forward
0 new messages