I work at a Servoy runtime application and I implemented a plugin for it.
In the plugin I have a class which calls native functions using JNI.
I run the application on Mac.
If I use my plugin in Servoy the “java.lang.UnsatisfiedLinkError” occurs, because the jni library (for example libmyapp.jnilib) cannot be found.
I put this library in the plugins and lib folder of Servoy, but the error still occurs.
To see what is wrong I made a test.jar with a class that uses this library and run it from a console with:
“java -jar test.jar” and it works fine only if the jni library is located in the same folder.
If it is on a different path I must use java -jar -Djava.library.path=/…
test.jar to tell java where to find the library.
Can somebody tell me how can I set the java.library.path in Servoy?
Maybe this way it will find my library.
Hai, don’t know what app you use to develop your plugin so this will be a generic answer.
You have an issue with the classpath from within your plugin not Servoy. So you should include the classpath to the library in your plugin.
When doing so there is no issue anymore. If I were you I would drop the library in the plugins directory (or create a specific folder under the plugings dir) and point to that location. That should do the trick.
In my resources section of my media-manager jnlp i have :
Libs are found just fine.
The point, maybe, is that the path is relative to ${servoy.home}; so, if your native lib exists in another directory tree, this could be the problem.
I used the JNLP file on Mac and on Windows and I put the native library in the plugins folder. It doesn’t work. The error message is java.lang.UnsatisfiedLinkError: no hello in java.library.path
<?xml version="1.0" encoding="utf-8"?>
Servoy Client Plugins
Servoy and Others
//for Mac the library has another name
If I run the plugin from the console or Eclipse everything is fine.
I don’t understand what I’m doing wrong. Why it works for you?