calling Java methods using JNI/C++ (via Swig) from Matlab -> UnsatisfiesLinkError
Hi,
I have got the following problem:
I would like to call a Java program from Matlab. The Java program calls a C++ procedure via JNI/SWIG. Calling the Java method without the Matlab framework, everything works fine. But when calling the Java method from Matlab, I get an UnsatisfiedLinkError.
??? Error using ==> javaObject
Java exception occurred:
java.lang.UnsatisfiedLinkError:
mylib.mylibJNI.new_myClass__SWIG_0()J
at mylib.mylibJNI.new_myClass__SWIG_0(Native
Method)
at mylib.myClass.<init>(myClass.java:39)
Error in ==> getDelta at 23
javaObject('mylib.myClass')
In Java, I defined a class 'myClass.java' in the package 'mylib'. With SWIG, the JNI interface class 'mylibJNI.java' and the library 'libMylib.so' are created.
In Matlab, I then load the classes and the library:
javaObject('mylib.myClass')
javaObject('mylib.mylibJNI')
java.lang.System.load('libMylib.so')
java.lang.System.load('<path>/libMylib.so')
But then, I get the error above.
Additionally, I added the path of the library to the variables $PATH and $LD_LIBRARY_PATH$, but I still get the same error.
I tried many things, but I have not any ideas any more. Could somebody give me a hint, why calling libraries does not work from Matlab, although it works when calling them directly from Java?
Thanks in advance!
1 commentaire
Réponses (3)
1 vote
Catégories
En savoir plus sur Call Java from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!