1

I have been trying to develop a play framework application. i am using opencv (.jar + native library) in this application. When i try to run the application with

play start

command the application runs fine and perfect. when tried with

play run

and it needs to access the opencv methods it gets a runtime error saying

java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_0(Ljava/lang/String;I)J
    at org.opencv.highgui.Highgui.imread_0(Native Method)
    at org.opencv.highgui.Highgui.imread(Highgui.java:299)
    at com.allspark.scanners.LabelImScanner.readLabel(LabelImScanner.java:39)
    at com.allspark.controllers.imageController.uploadLabel(imageController.java:55)
    at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:289)
    at Routes$$anonfun$routes$1$$anonfun$applyOrElse$19$$anonfun$apply$19.apply(routes_routing.scala:289)

then I tried to run the application in production mode then everything works fine. I need to know how to load the native library to play application runs in development mode. This issue already discussed in followings: https://groups.google.com/forum/#!topic/play-framework/A3cL3dkD70I https://github.com/playframework/playframework/issues/2212 How to include native library (JNI) in play 2.1 RC2?

but unfortunately nothing works for development mode application. I am using play famework 2.2.0 and opencv-246. If anyone can give support that would be great help.Thank you. Appreciate your help

Community
  • 1
  • 1
shadee
  • 160
  • 3
  • 11

1 Answers1

0

There are two ways:

1. Create a /lib folder in you play project and then play clean and compile (SBT will take care of every thing)

2.

cp  opencv-2412.jar /your-play-project/target/native_libraries/64bits/
cp  ibopencv_java2412.dylib  /your-play-project/target/native_libraries/64bits/

then play clean and compile

Jack Leow
  • 21,945
  • 4
  • 50
  • 55
Debojit Paul
  • 213
  • 4
  • 12