Javacv: java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path

Created on 13 Apr 2015  路  12Comments  路  Source: bytedeco/javacv

I am using sbt to add the javacv to the project , my project has both OpnCV and JavaCV and my java Options are following , I have also manually added all jar files to lib/javacv folder,

 javaOptions in run += "-Djava.library.path=lib/opencv/:lib/javacv:-Dplatform.dependencies=true"


[error] java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path
[error]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
[error]     at java.lang.Runtime.loadLibrary0(Runtime.java:870)
[error]     at java.lang.System.loadLibrary(System.java:1122)
[error]     at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:536)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:411)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:354)
[error]     at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
[error]     at java.lang.Class.forName0(Native Method)
[error]     at java.lang.Class.forName(Class.java:348)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:386)
[error]     at org.bytedeco.javacpp.Loader.load(Loader.java:354)
[error]     at org.bytedeco.javacpp.opencv_highgui.<clinit>(opencv_highgui.java:13)

the instructions are not the very best to get things set up, any help woud be great, following is in my sbt libs

classpathTypes += "maven-plugin"

libraryDependencies += "org.bytedeco" % "javacv" % "0.11"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11"

Cheers

enhancement

Most helpful comment

Right, it could be better, but at the core, the problem is sbt not supporting a standard Maven feature, so I'm not sure what we should do. I'm opened to ideas, so if you have any, please do share them. For the moment, we have to add lines like these:

libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "linux-x86"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "linux-x86_64"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "macosx-x86_64"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "windows-x86"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "windows-x86_64"

And similarly for the other libraries.

All 12 comments

moving libraries to lib folder from lib/javacv resolved the issue for the moment

Right, it could be better, but at the core, the problem is sbt not supporting a standard Maven feature, so I'm not sure what we should do. I'm opened to ideas, so if you have any, please do share them. For the moment, we have to add lines like these:

libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "linux-x86"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "linux-x86_64"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "macosx-x86_64"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "windows-x86"
libraryDependencies += "org.bytedeco.javacpp-presets" % "opencv" % "2.4.11-0.11" classifier "windows-x86_64"

And similarly for the other libraries.

thanks @saudet , solved the problem, this info on the instruction page would be really help other developers

Actually, we could make a little script in Scala to compensate. That would be much better than 100 lines of dependencies... Would you have time to look into that?

I can do it , but not anytime soon. hopefully will commit out of my experience

Cheers

Thanks @saudet!
I can solve same problem with your advice.
I am running the JavaCV 1.0 on the IntelliJ 14.

dependencies {
    compile group: 'org.bytedeco', name: 'javacv', version: '1.0'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'macosx-x86_64'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'macosx-x86_64'
}

@baconsword what have you tried to solve your issue?

@saudet well... 3 things.
1 - I'm using IntelliJ 14, with Gradle adding up @skyfe79 config mentioned above.
2 - I was behind a proxy and somehow that may have influenced Gradle to not download the jars.
3 - I changed all dependencies declarations from this:
'compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'macosx-x86_64''

to this:

compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.0:windows-x86_64'

Idiot... I know... If it works for you... tell me!

Are you saying that it works now??

BTW, IntelliJ IDEA supports Maven better than Gradle, so unless you have a reason to use Gradle, I would suggest to try Maven.

Yes, it is working.
(About Maven: That XML scares me.)

dependencies {
    compile 'org.bytedeco:javacv:1.0'
    compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.0:windows-x86_64'
    compile 'org.bytedeco.javacpp-presets:ffmpeg:2.7.1-1.0:windows-x86_64'
}

Did 'grouping' Gradle's dependencies declaration config work for someone?

just copy all the e.g C:\opencv\build\x86\vc10\bin dlls to system32 folder. Cheers. worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmedaomda picture ahmedaomda  路  4Comments

y4nnick picture y4nnick  路  3Comments

cansik picture cansik  路  4Comments

SenudaJayalath picture SenudaJayalath  路  3Comments

UpAndDownAgain picture UpAndDownAgain  路  3Comments