Error occurred "java.lang.UnsatisfiedLinkError" using opencv in the Spring boot

28 Views Asked by At
@SpringBootApplication
public class VisionXApplication {

  public static void main(String[] args) throws Exception {

    SpringApplication.run(VisionXApplication.class, args);

    System.out.println(System.getProperty("java.library.path"));
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    System.out.println("Welcome to OpenCV " + Core.VERSION);

    Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
    System.out.println("m = " + m.dump());
  }
}

Error occurred on above code in the Spring boot project.

I searched various case on the google and charGPT.

But i couldn't resolved this problem.

This code works well on the java code. Please help me.

C:\app\opencv\build\java\x64
Welcome to OpenCV 4.7.0-dev
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50)
Caused by: java.lang.UnsatisfiedLinkError: 'long org.opencv.core.Mat.n_eye(int, int, int)'
    at org.opencv.core.Mat.n_eye(Native Method)
    at org.opencv.core.Mat.eye(Mat.java:402)
    at com.deltax.VisionXApplication.main(VisionXApplication.java:27)
    ... 5 more

0

0

There are 0 best solutions below