intellij refuses to find native library

已回答

i wanted to test out the Java version of opencv (https://opencv.org). i added it as a library:

i made sure to add the native libraries as well (they provided two .dll files in the java section, i added both) 

however, when i tried to declare a variable using one of the library's data types, it gave me an UnsatisfiedLinkError

i cannon seem to get this error to go away; none of these strategies i tried worked: reinstalling the library, specifying the full path of the library using java.library.path JVM argument, and even putting one of the .dll files inside my working directory

am i just doing something stupid? any help is appreciated.

0

You’re almost there. That UnsatisfiedLinkError means the OpenCV JAR was found, but the native DLL wasn’t loaded.

Make sure you’re using the 64-bit DLL, not the one in x86, since JBR is 64-bit.
Update your VM options in Run | Edit Configurations | VM options to point at it:

-Djava.library.path="C:\path\to\opencv\build\java\x64" 

Then load the native library before using OpenCV.

0

请先登录再写评论。