我正在构建一个更新系统,其中我需要能够在运行时替换正在运行的应用程序 jar 的引用 jar。但是,当我尝试在 jar 上执行文件实用程序功能(例如“setLastModified”)时,我在 Windows 上遇到了文件锁定问题。
经过一番谷歌搜索后,我发现了这个片段......
What I found in my research is that the standard ClassLoader implementation never closes a jar file once it has been opened. It also only loads resources from the jar file as needed. So at any particular time, there may be Classes in the jar file that have not been loaded into memory. Obviously, if you delete the jar file out from under the ClassLoader, and it tries to find a resource in the missing file, you're going to get an IOException at the very least.
是否有人引用了有关执行此操作或解决此问题的信息?
谢谢。
最佳答案
关于java - 在运行时交换正在运行的 jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3621505/