Reputation: 2897
I am trying to use opencv in a Scala application built using sbt and this is my build.sbt
name := "Marker"
version := "1.0"
scalaVersion := "2.11.8"
javaOptions in run += "-Djava.library.path=/home/priyatham/libs/opencv-3.1.0/build/lib"
And this the error I am getting when I sbt run
[error] (run-main-0) java.lang.UnsatisfiedLinkError: no opencv_java310 in java.library.path
java.lang.UnsatisfiedLinkError: no opencv_java310 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at Main$.main(Main.scala:10)
at Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 1 s, completed 13 Sep, 2016 8:40:09 PM
What's wrong with the way I am modifying java.library.path
EDIT: I did put the opencv-310.jar
in Marker/lib
folder
Compiling with java -Djava.library.path="/home/priyatham/libs/opencv-3.1.0/build/lib"
works though, but not with sbt run
Upvotes: 1
Views: 708
Reputation: 20436
EDITED:
Add fork in run := true
. I think now it tries to run your code in same JVM so javaOptions is not applied.
Upvotes: 3