如何在scala的解释器中将外部库添加到类路径?

时间:2023-01-11 20:46:40

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?

我正在尝试引用Scala Interpreter中使用Eclipse编写和编译的一些类。 Eclipse将编译的Java字节代码存储在{workspace} / myProject / bin文件夹中。是否有一些命令将此文件夹添加到Scala Interpreter使用的类路径中?

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

也许scala.bat应该用一些参数进行编辑或参数化?

2 个解决方案

#1


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

启动解释器时使用-classpath或-cp标志:

scala -cp /path/to/classfiles

#2


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

您可以编辑scala.bat,或者更改为复制以保持原始版本不变。

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

您可能希望使用call:add_cpath“...”来添加它,就像在该批处理文件中的某处使用一样。

#1


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

启动解释器时使用-classpath或-cp标志:

scala -cp /path/to/classfiles

#2


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

您可以编辑scala.bat,或者更改为复制以保持原始版本不变。

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

您可能希望使用call:add_cpath“...”来添加它,就像在该批处理文件中的某处使用一样。