开发者

Scala, problem with a jar file

开发者 https://www.devze.com 2023-03-14 22:13 出处:网络
I haven\'t worked with java/scala a lot, so my problem might be very obvious, but here it is: I\'m working on a scala program, and I want to import from a .jar file (filename.jar) in a sub-directory.

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

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 f开发者_StackOverflow中文版ilename is not a member of package sub."

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"

I'd appreciate any help.


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.


ok, so i am going to change my comment into an answer:

add the jar file to your classpath :)

0

精彩评论

暂无评论...
验证码 换一张
取 消