Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add external library to the classpath in scala's interpreter?

I'm trying to reference some classes in the Scala Interpreter that were writen and compiled using Eclipse. Eclipse stores compiled Java byte code in a folder {workspace}/myProject/bin. Is there some command which will add this folder to the classpath used by the Scala Interpreter?

Maybe scala.bat should be edited or parameterized with some argument?

like image 729
Boris Pavlović Avatar asked Apr 08 '09 14:04

Boris Pavlović


2 Answers

Use the -classpath or -cp flags when launching the interpreter:

scala -cp /path/to/classfiles
like image 83
Jorge Ortiz Avatar answered Nov 12 '22 05:11

Jorge Ortiz


You can edit scala.bat, or rather make a copy to leave the original unchanged.

You will probably want to use call :add_cpath "..." to add it, as is used somewhere in that batch file.

like image 20
Germán Avatar answered Nov 12 '22 06:11

Germán