Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path #122

Closed
ahsandar opened this issue Apr 13, 2015 · 12 comments
Closed

Comments

@ahsandar
Copy link

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

@ahsandar
Copy link
Author

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

@saudet
Copy link
Member

saudet commented Apr 13, 2015

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.

@ahsandar
Copy link
Author

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

@saudet
Copy link
Member

saudet commented Apr 13, 2015

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?

@ahsandar
Copy link
Author

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

Cheers

@skyfe79
Copy link

skyfe79 commented Aug 12, 2015

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'
}

@saudet
Copy link
Member

saudet commented Sep 2, 2015 via email

@ghost
Copy link

ghost commented Sep 2, 2015

@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!

@saudet
Copy link
Member

saudet commented Sep 2, 2015

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.

@ghost
Copy link

ghost commented Sep 2, 2015

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'
}

JLLeitschuh added a commit to JLLeitschuh/GRIP that referenced this issue Sep 2, 2015
@ghost
Copy link

ghost commented Sep 4, 2015

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

@sefarov92
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants