Packaging OpenCV with a Java Program

asked 2013-09-12 04:53:04 -0500

alistair3408 gravatar image

updated 2013-09-12 10:10:01 -0500

I've been using Opencv 2.4.5 with Java for a while building an application and would now like to distribute the app. The library is loaded using the following:


which works fine. However, when exporting, it doesn't get pulled into the jar file.

The opencv_java245.jar file is included as a user library, with a native file (libopencv_java245.dylib) connected to it. When running the executable jar generated from Eclipse, I get the UnsatisfiedLinkError below, despite things compiling/running fine in eclipse.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java245 in java.library.path
    at java.lang.ClassLoader.loadLibrary(
    at java.lang.Runtime.loadLibrary0(
    at java.lang.System.loadLibrary(
    at com.drawbridge.Main.<clinit>(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(

Anyone know a simple way of packaging OpenCV in the jar?

edit retag flag offensive close merge delete