简体   繁体   中英

How to copy text files inside a .jar file when the .jar is executed

I want to make modifications to a text file inside a .jar and hence instead of directly writing into a file in the .jar file thought of copying the files onto an external location and making modifications to that. How can i do this?

Yes, it is possible to do that without extracting and re-jarring. Use the following command

jar uf jar-file input-file(s)

In archive, files having same pathname as file being added would be overwritten.

As it is a file it is easy to modify and there would be no need to re-build the jar

See this reference for further details : http://docs.oracle.com/javase/tutorial/deployment/jar/update.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM