I am trying to call OpenCV from an application server that uses Java Reflection.
The call to System.loadLibrary()
succeeds, and I am able to get a refence to the org.opencv.core.Mat
class, so both the native library and the jar file are in the right place.
But when I try to instantiate it, I get the following exception:
org.opencv.core.Mat.n_Mat()J at org.opencv.core.Mat.n_Mat(Native Method) at org.opencv.core.Mat.(Mat.java:26) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
So the no-arg constructor is called (1), but then throws an exception (2) when it tries to reference the native method (3).
Is there anything special that I should be aware of when calling native methods via Reflection?
Aucun commentaire:
Enregistrer un commentaire