Scala, jar file issue

I have not worked with java / scala a lot, so my problem can be very obvious, but here it is:

I am working on a scala program and I want to import from a .jar file (filename.jar) into a subdirectory. I believe this will work:

import sub.filename._ 

But I get an error: "The file name of the object is not a member of the package."

So I'm trying to just move the jar file to the same directory as the scala program:

 import filename._ 

And I get: "not found: object filename"

I would appreciate any help.

+2
source share
2 answers

This does not work. You import things from packages, not from directories. If you have a JAR somewhere, you need to run Scala with a classpath parameter pointing to all the JARs that you want to access.

+3
source

ok, so I'm going to change my comment in response:

add jar file to your class path :)

+2
source

Source: https://habr.com/ru/post/1489315/


All Articles