Kamal Joshi
Kamal Joshi

Reputation: 1777

How to unload a dll which gets loaded by System.load(path to dll)

Is there any way to unload a DLL which gets loaded in the application using System.load() API call.

Upvotes: 4

Views: 5648

Answers (1)

tangens
tangens

Reputation: 39733

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.

Upvotes: 5

Related Questions