Moving a running can at runtime

I am creating an update system in which I need to be able to replace the mentioned jar of a running application banner at runtime. However, I encounter problems blocking files on Windows when I try to execute utility functions on the bank, such as "setLastModified".

After some searches, I found this snippet ...

What I found in my research is that the standard ClassLoader implementation never closes the jar file after it is opened. It also only loads resources from the jar file as needed. Therefore, at any given moment in time, there may be classes in the jar file that were not loaded into memory. Obviously, if you delete the jar file from under the ClassLoader class, and it tries to find the resource in the missing file, you will get an IOException, at least.

Does anyone have any links to information on how to do this, or work on this issue?

Thank.

+5
source share
3 answers

There are many solutions for hot swapping classes / lib:

, .

+5

OSGi

, ". " .

+2

, . , .

, . , , , .

0

All Articles