I have created a jar-file with a compiled Java class. Now I want to import it in Scala. But it doesn't work.
The package name is se.mydomain.testproj and here is a small Scala application:
object TestCrypt {
import se.mydomain.testproj._
def main(args: Array[String]) {
println("Hello")
}
}
I use Eclipse and have added the jar file to the Build Path.
In Eclipse, I get the error: not found: value se
How can I import Java classes from a Jar file in Scala?
I do this all the time in Eclipse, so it definitely works. Do you see the jar in the Referenced Libraries of the project? Do you have the package name right?
Also, an import in the object as opposed to the top of the file should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With