sorowd
sorowd

Reputation: 114

Scala, problem with a jar file

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 filename 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.

Upvotes: 3

Views: 1078

Answers (2)

Alex
Alex

Reputation: 2382

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

add the jar file to your classpath :)

Upvotes: 3

Daniel C. Sobral
Daniel C. Sobral

Reputation: 297165

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.

Upvotes: 4

Related Questions