I am using the Play Framework and Scala. I need to add a Java library that has some JNI libraries dependencies. On their site they say to put the native libraries in java.library.path
. How do I add the native libraries to an SBT project using Scala?
Asked
Active
Viewed 2,241 times
1

danielz
- 1,767
- 14
- 20
-
Additionally see https://stackoverflow.com/questions/25524109/sbt-cross-platform-way-to-set-java-library-path – Alexey Romanov Oct 16 '15 at 23:07
1 Answers
0
You can add it as an unmanaged dependency, or just put the JAR into a /lib folder under your project root. It will then be available on your classpath.

Community
- 1
- 1

Garrett Hall
- 29,524
- 10
- 61
- 76
-
1[This](https://code.google.com/p/junixsocket/wiki/GettingStarted) is the library I am using. I am able to add the the jar file to the lib folder as an unmanaged dependency but I am not able to load the native library, the `.so` file using the `java.library.path`. – danielz Oct 16 '15 at 16:26
-
In my humble experience, sometimes, the native `.so` file is loaded not from within the jar, in which case it needs to be available flat on disk in a place your runtime or JVM can find it, otherwise we get the same error even though the jar is well found and loaded (and _does contain_ a copy of the `.so` file). – matanster Jun 13 '18 at 09:26