Scala,jar文件的问题 [英] Scala, problem with a jar file

查看:111
本文介绍了Scala,jar文件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有经常使用java / scala,所以我的问题可能非常明显,但这里是:

I haven't worked with java/scala a lot, so my problem might be very obvious, but here it is:

我正在研究scala程序,我想从子目录中的.jar文件(filename.jar)导入。我认为这样可行:

I'm working on a scala program, and I want to import from a .jar file (filename.jar) in a sub-directory. I figure that this will work:

import sub.filename._

但我收到错误:对象文件名不是包子的成员。

But I get the error: "Object filename is not a member of package sub."

所以我尝试将jar文件移动到与scala程序相同的目录:

So I try simply moving the jar file to the same directory as the scala program:

import filename._

我得到:未找到:对象文件名

And I get: "not found: object filename"

我感谢任何帮助。

推荐答案

这不起作用。您从包中导入东西,而不是目录。如果您在某处有JAR,则需要使用 classpath 参数启动Scala,该参数指向您要访问的所有JAR。

That doesn't work. You import things from packages, not directories. If you have a JAR somewhere, you need to start Scala with the classpath parameter pointing to all JARs you want access to.

这篇关于Scala,jar文件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆