Ask Your Question

Yoonje Choi's profile - activity

2016-02-03 07:05:29 -0500 received badge  Famous Question (source)
2016-01-05 01:28:28 -0500 received badge  Nice Answer (source)
2015-01-29 16:13:47 -0500 received badge  Notable Question (source)
2014-10-05 08:14:54 -0500 received badge  Teacher (source)
2014-07-22 02:09:03 -0500 received badge  Popular Question (source)
2013-10-28 02:51:13 -0500 received badge  Student (source)
2013-07-25 15:15:43 -0500 received badge  Self-Learner (source)
2013-07-19 04:31:06 -0500 commented answer JNI error on playframework v2.1.1 UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

I wrote an answer below. Check it out.

2013-07-19 04:30:05 -0500 answered a question JNI error on playframework v2.1.1 UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

When you want to use OpenCV or any other native libraries on Playframework, You MUST run your application with "play start" command, not "play run".

"play run" command starts your application in development mode and "play start" command starts in production mode. I don't know every difference between them but one obvious thing is ,

Only when we use "play start", a new JVM for you application is launched and it loads native libraries you specified by System.load("/absolute/path/to/your/so/or/jnilib/inOSX/not/dylib/filename.jnilib");

How to load native lib is following.

Create Global.java which has empty package name. (refer this link )

public class Global extends GlobalSettings {

@Override
public void beforeStart(Application app) {
    // TODO Auto-generated method stub
    super.beforeStart(app);

    String libopencv_java = "/Users/yoonjechoi/git/myFirstApp/target/native_libraries/64bits/libopencv_java246.jnilib";
    System.load(libopencv_java);
}

}

then you can use classes of OpenCV in your Play application's controllers.

System.loadLibrary("opencv_java246") doesn't works. I don't know why. I don't have time to dig why. -_-;

Please give hints if you know why.

2013-07-19 04:24:31 -0500 received badge  Self-Learner (source)
2013-07-19 04:13:32 -0500 received badge  Editor (source)
2013-07-18 08:15:19 -0500 answered a question JNI error on playframework v2.1.1 UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

I solved the problem.

For those who use osx version other than v10.5 and Apple's JDK (maybe jdk 6), not oracle's jdk.

If you get UnsatisfiedLinkError with JNI, CHANGE your native library file extension to ".jnilib". Though java.library.path property is set properly, JVM may not load native library if file extension is not ".jnilib" such as ".dylib".

According to apple's doc on https://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html "JNI libraries are named with the library name used in the System.loadLibrary() method of your Java code, prefixed by lib and suffixed with .jnilib. For example, System.loadLibrary("hello") loads the library named libhello.jnilib. Java HotSpot also recognizes .dylib as a valid JNI library format as of Mac OS X v10.5."

Maybe on v10.5, ".dylib" works. But in my case on v10.8.4, mountain lion, ".dylib" doesn't work.

If you get problem during java development on mac, FIND documentation on developer.apple.com as well as oracle's doc. Don't forget that you may use Apple's JDK.!!

[UPDATE] This solution is only for Glassfish v3. It doesn't works for Play framework. I Just wrote after experimenting on glassfish. I'm so sorry confuse you. But I found a way for Play framework too and going to write about it right now~

2013-07-16 08:11:15 -0500 answered a question JNI UnsatisfiedLinkError when running ant sample on Ubuntu

Dear guys

I got very similar problem with play framework. I posted this, http://answers.opencv.org/question/16689/jni-error-on-playframework-v211/ .

ggl, was it a classloader related problem? In my case, I hardly find a clue where should I start to solve because the other jni libraries works well but opencv doesn't.

symbol table problem with compilation or classloader related problem?

Thanks in advance..

2013-07-15 00:41:00 -0500 asked a question JNI error on playframework v2.1.1 UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J

Hi, I'm trying to run HelloCV example on playframework through JNI. java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_Mat(IIIDDDD)J occured.

I read an issue about gcc visibility option. http://code.opencv.org/issues/3077#note-3

Though I tried using opencv-249 which has fixed a visibility issue, the same error occurs.

If I use openCV not on playframework, UnsatisfiedLinkError doesn't occur. working well. Only when I run HelloCV on playframework, UnsatisfiedLinkError occurs..

Does anybody have a clue?