Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are missing the opencv_java300.dll in your library path. You could either specify its location by using -Djava.library.path=... when you start the program or you could use this piece of code in your main method:

    System.setProperty("java.library.path", ".");

    Field fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" );
    fieldSysPath.setAccessible( true );
    fieldSysPath.set( null, null );

The problem with the build path in eclipse is that you need to use an absolute path for the native library location. Nobody wants that. With the code above you remap the library path to a relative path, so when you copy your project or rename it, you don't have to mess around with the build path settings. Your code would still work.

The "." means that in your created jar the dlls must be in the same folder as the jar. You could of course use a sub-folder, eg ./lib/x64. Then you need to have the libraries in that sub-folder in both eclipse and your jar's location.