I need to unload a DLL that was loaded with System.loadLibrary(..)
, anyone know if this is possible?
How to unload library (DLL) from the JVM
Asked Answered
I don't have any experience of this, but a bit of digging shows that the library should be unloaded when the classloader which loaded the library is garbage collected.
Links:
I just wasted 3 hours on this: The Java JNI DLL Unloading tutorial works, but you cannot have a finalize() method in either your CustomClassLoader or your class that contains the native method! I did not investigate why, but my guess is that it's related to the deprecation of finalize(). When removing the finalize from the example code everything works great! –
Peltz
© 2022 - 2024 — McMap. All rights reserved.