修改jar中的文件 [英] Modifying a file inside a jar
问题描述
我想修改jar中的文件。是否有可能在我的应用程序中没有提取和重新震动的情况下执行此操作?
I would like to modify a file inside my jar. Is it possible to do this without extracting and re jarring, from within my application?
我想要修改的文件是配置文件,主要是基于xml的。
File i want to modify are configuration files, mostly xml based.
我感兴趣的不是非常刺激的原因是应用程序是用launch4j包装的,如果我解开它我无法再次创建.exe文件。
The reason i am interested in not un jarring is that the application is wrapped with launch4j if i unjar it i can't create the .exe file again.
推荐答案
您可以使用 u
选项 jar
来自Java教程:
jar uf jar-file input-file(s)
存档中已存在与文件具有相同路径名的任何文件添加将被覆盖。
"Any files already in the archive having the same pathname as a file being added will be overwritten."
参见更新JAR文件。
比让整个罐子重新制作好多了。从你的程序中调用它听起来也是可能的。尝试使用Java运行命令行
Much better than making the whole jar all over again. Invoking this from within your program sounds possible too. Try Running Command Line in Java
这篇关于修改jar中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!