Include jar file in Scala interpreter

BefittingTheorem picture BefittingTheorem · Nov 10, 2009 · Viewed 19.4k times · Source

Is it possible to include a jar file run running the Scala interpreter?

My code is working when I compile from scalac:

scalac script.scala -classpath *.jar

But I would like to be able to include a jar file when running the interpreter.

Answer

Eastsun picture Eastsun · Nov 10, 2009

In scala2.8,you can use

scala>:jar JarName.jar

to add a jar to the classpath.

In Scala 2.8.1, it is not :jar but :cp

And in Scala 2.11.7 it is not :cp but :re(quire)