java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path on Mac OS X with IntelliJ and Gradle

1,440 views
Skip to first unread message

jhoffjann

unread,
Sep 15, 2014, 9:49:54 AM9/15/14
to jav...@googlegroups.com
Hi,

I'm currently trying to get JavaCV running with IntelliJ. I automatically downloaded and installed it with Gradle:

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile group: 'org.bytedeco', name: 'javacv', version: '0.9'
}



All the dependencies are now listed under External Libraries.

Everytime I now try to start this simple thing I just get two errors.

import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
import static org.bytedeco.javacpp.opencv_highgui.*;

public class SimpleSample {

    public static void main(String[] args) {
        IplImage image = cvLoadImage("CocaCola.jpg");
        if (image != null){
            cvSmooth(image, image);
            cvSaveImage("smoothCola.jpg", image);
            cvReleaseImage(image);
        }

    }
}

Those are the erros:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1764)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1044)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:410)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at org.bytedeco.javacpp.Loader.load(Loader.java:385)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_highgui.<clinit>(opencv_highgui.java:13)
at SimpleSample.main(SimpleSample.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_core in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1764)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1044)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:401)
... 13 more


Any help would be appreciated.


Samuel Audet

unread,
Sep 20, 2014, 6:23:33 AM9/20/14
to jav...@googlegroups.com
On 09/15/2014 10:49 PM, jhoffjann wrote:
> Any help would be appreciated.

Try to execute gradle with the `-Dplatform.dependencies=true` option.

Samuel

Michael Hotan

unread,
Nov 29, 2014, 9:26:49 PM11/29/14
to jav...@googlegroups.com
Did we ever find out if this resolved the issue?

Samuel Audet

unread,
Dec 6, 2014, 4:41:45 AM12/6/14
to jav...@googlegroups.com
On 11/30/2014 11:26 AM, Michael Hotan wrote:
> Did we ever find out if this resolved the issue?

I don't know, I haven't tried it with Gradle myself, but these kinds of
features are supposed to be supported :) Does it work for you? Would be
good to know for sure. Thanks!

Samuel

Jonatan Borkowski

unread,
Dec 7, 2014, 2:14:00 PM12/7/14
to jav...@googlegroups.com
Samuel... I need your help. I tried include project "javacv 0.9.1-SNAPSHOT" in Android Studio 1.0 RC4. And it doesn't work... 
I am trying to use FFmpegFrameGrabber and I'm getting result 
"ailed: dlopen failed: cannot locate symbol "av_input_audio_device_next" referenced by "libjniavdevice.so"..."
or "java.lang.UnsatisfiedLinkError..."

Please Help;)

Jonathan

Samuel Audet

unread,
Dec 14, 2014, 6:45:07 AM12/14/14
to jav...@googlegroups.com
That has been fixed here:
https://github.com/bytedeco/javacv/commit/b5eacbac21cba6665e8bc25036580df4d5777e12

Anyway, just use the latest FFmpegFrameGrabber from the develop branch
and all should be fine.

Samuel

Reply all
Reply to author
Forward
0 new messages