如何删除正在执行的jar文件 [英] How to delete a executing jar file

查看:221
本文介绍了如何删除正在执行的jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个应用程序,其中基于一个操作,它修改了jar中的属性文件。

我可以创建一个新的temp jar随着更新的变化。但是不能将jar文件重命名为现有的jar文件名。

任何人都可以建议任何操作或建议来删除jar(Currently Executing),并将temp jar到那个名字?



我已经为应用程序做了:
http://java.net/projects_tags/jeazyprops

解决方案

可能你需要编写一个自定义类加载器(扩展ClassLoader),使您可以加载/卸载该jar。如果你可以卸载jar,你应该可以删除这个jar。



有用的链接
http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html



我可以动态卸载并重新加载(其他版本的相同)JAR吗?


I have created an application, in which based on an operation, it modifies the properties file inside the jar.

I'm able to create a new temp jar with the updated changes. But can't rename the jar file to the existing jar file name. Since it is running, I am not able to delete and rename it.

Can any one suggest any operations or suggestions to delete the jar (Currently Executing) and rename the temp jar to that name?

I have doing for the Application: http://java.net/projects_tags/jeazyprops

解决方案

May be you would need to write a custom class loader(extending ClassLoader) which enables you to load/unload the jar. You should be able to delete the jar if you can unload the jar.

Useful links http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html

Can I dynamically unload and reload (other versions of the same) JAR?

这篇关于如何删除正在执行的jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆