具体错误
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/taishansoft/eclipse-workspace/FontTest/lib-native/libopencv_java420.dylib: dlopen(/Users/taishansoft/eclipse-workspace/FontTest/lib-native/libopencv_java420.dylib, 1): Library not loaded: @rpath/libopencv_ml.4.2.dylib Referenced from: /Users/taishansoft/eclipse-workspace/FontTest/lib-native/libopencv_java420.dylib Reason: image not found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817) at java.lang.Runtime.load0(Runtime.java:810) at java.lang.System.load(System.java:1088) at taishan.OpenCVTest.<clinit>(OpenCVTest.java:23)
原因
就是加载A库时,找不到B库。
解决办法有两个
把相应的库,复制到/usr/lib或/usr/local/lib下。
去掉rpath参数,重新编译。