Is there any way to unload a DLL which gets loaded in the application using System.load() API call.
+2
A:
You have to use a separate ClassLoader to load the dll. The dll is only bound to the ClassLoader it was loaded with. When the ClassLoader isn't used anymore (means no references to the ClassLoader exist), the garbage collector will free your ClassLoader and unload your dll.
tangens
2009-09-29 07:32:15
That's the easiest way. I've also used a stub library that performs the loading of the real one from within the JNI code, that way I controlled it's loading an unloading explicitly.
Petesh
2009-09-29 07:34:08
@Petesh Could you explain your approach a bit more. How exactly you handled unloading part?
Kamal Joshi
2009-09-29 08:31:58
A:
Similiar question was answered some time ago :) You can read this: http://stackoverflow.com/questions/1433155/how-to-reverse-system-loadlibrary-in-java/1433196#1433196
pir0
2009-09-29 08:40:47