1 | initial version |
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 knows why.
2 | Use "play start" not "play run" |
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 knows know why.