PF4J and native library embedded in a plugin

6 views
Skip to first unread message

Jérôme Mainaud

unread,
Dec 19, 2023, 11:19:25 AM12/19/23
to pf4j
Hello,

I have a plugin that uses a java library (say mssql-jdbc).
In general, that library works fine.

However, some functionalities (say Windows integrated authentication) need a native library (say mssql-jdbc_auth) to work.

I'm able to add the native lib in the plugin package. However, I don't know how to make it available. The java library uses System.loadLibrary() method to load the native library. This method only load libraries from folders listed in the "java.library.path" system property.

Because the main application should not know implementation details of the plugins, I tried to modify the "java.library.path" system property when the Plugin class is created, and before the classes of mssql-jdbc are loaded.

But the change is not taken into account. And the only solution I found for now is to add  the path of the folder in the system property before the java invocation which is not friendly because:
  1. Path change depending on the version of the plugin which is deployed.
  2. Folders don't exist before the first execution (take zip files into account is more complex)
  3. Windows batch scripting is a nightmare. (I don't need to use the native lib when running on another OS.)
Did someone already met this issue ? 
Do you have any advice on how I should solve this problem ?

Thank you,
Reply all
Reply to author
Forward
0 new messages