How to use OpenCV in Java Play2 with IntelliJ

asked 2013-07-17 16:31:05 -0500

updated 2013-07-17 19:16:19 -0500

Can someone detail the step-by-step process for setting up IntelliJ to use OpenCV?

The docs are really helpful if you are using something like Eclipse: http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html

But I haven't been able to figure out the equivalent process in IntelliJ. Note that I'm not making an Android app - I just want to leverage the Java implementation of OpenCV on the back-end of our web service. See my stack overflow post here for additional details: http://stackoverflow.com/questions/17708150/intellij-does-not-find-native-libraries-for-opencv-when-adding-jar-as-a-dependen

If it helps narrow the potential cause of the problem, following all the steps for Running SBT Samples in the OpenCV Java Docs also gives me a similar error:


charles@charles-VirtualBox:~/JavaSample$ sbt run
[info] Loading project definition from /home/charles/JavaSample/project
[info] Set current project to JavaSample (in build file:/home/charles/JavaSample/)
[info] Compiling 1 Java source to /home/charles/JavaSample/target/scala-2.10/classes...
[info] Running HelloOpenCV 
Hello, OpenCV
[error] (run-main) java.lang.UnsatisfiedLinkError: no opencv_java246 in java.library.path
java.lang.UnsatisfiedLinkError: no opencv_java246 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856)
    at java.lang.Runtime.loadLibrary0(Runtime.java:845)
    at java.lang.System.loadLibrary(System.java:1084)
    at HelloOpenCV.main(HelloOpenCV.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
[trace] Stack trace suppressed: run last compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) Nonzero exit code: 1
[error] Total time: 2 s, completed Jul 17, 2013 5:11:39 PM
edit retag flag offensive close merge delete