How to unload Dll in java?

I wrote a Java agent in Lotus Notes 8.5 to reset a token PIN using IAIKPKCS11wrapper. When the agent boots for the first time, it worked well. But after I closed and restarted the agent, this did not work. Checking console output I found the following error:

Exception in thread "AgentThread: JavaAgent" java.lang.UnsatisfiedLinkError: pkcs11wrapper (the library is already loaded in another ClassLoader)

I was looking for a group, but the closest I could find is that it is not possible to unload the DLL, but I still don't know how to handle it.

Can someone point me to a solution?

+4
source share
2 answers

From one of the related SO questions, this DLL unloading tutorial is found.

+1
source

Try adding a jar to the Lotus Notes class path in notes.ini :

 JavaUserClasses=...;yourAgent.jar 

or copy the jar to the default Notes directory, which should look something like this: C:\lotus\notes\jvm\lib\ext

Another thing to try is to put your dll in C:\lotus\notes.

-1
source

Source: https://habr.com/ru/post/1339172/


All Articles