Updating a JAR File
来源:互联网 发布:js prompt没弹出来 编辑:程序博客网 时间:2024/05/20 05:08
The Jar tool provides a u option which you can use to update the contents of an existing JAR file by modifying its manifest or by adding files.
The basic command for adding files has this format:
jar uf jar-file input-file(s)
In this command:
- The u option indicates that you want to update an existing JAR file.
- The f option indicates that the JAR file to update is specified on the command line.
- jar-file is the existing JAR file that is to be updated.
- input-file(s) is a space-delimited list of one or more files that you want to add to the JAR file.
Any files already in the archive having the same pathname as a file being added will be overwritten.
When creating a new JAR file, you can optionally use the -C option to indicate a change of directory. For more information, see the Creating a JAR File section.
Examples
Recall that TicTacToe.jar has these contents:
META-INF/MANIFEST.MFTicTacToe.classTicTacToe.classTicTacToe.javaaudio/audio/beep.auaudio/ding.auaudio/return.auaudio/yahoo1.auaudio/yahoo2.auexample1.htmlimages/images/cross.gifimages/not.gif
Suppose that you want to add the file images/new.gif to the JAR file. You could accomplish that by issuing this command from the parent directory of the images directory:
jar uf TicTacToe.jar images/new.gif
The revised JAR file would have this table of contents:
META-INF/MANIFEST.MFTicTacToe.classTicTacToe.classTicTacToe.javaaudio/audio/beep.auaudio/ding.auaudio/return.auaudio/yahoo1.auaudio/yahoo2.auexample1.htmlimages/images/cross.gifimages/not.gifimages/new.gif
You can use the -C option to "change directories" during execution of the command. For example:
jar uf TicTacToe.jar -C images new.gif
This command would change to the images directory before adding new.gif to the JAR file. The images directory would not be included in the pathname of new.gif when it's added to the archive, resulting in a table of contents that looks like this:
META-INF/MANIFEST.MFMETA-INF/MANIFEST.MFTicTacToe.classTicTacToe.classTicTacToe.javaaudio/audio/beep.auaudio/ding.auaudio/return.auaudio/yahoo1.auaudio/yahoo2.auexample1.htmlimages/images/cross.gifimages/not.gifnew.gif
- Updating a JAR File
- Gradle: Running a jar file
- Read file from inside a JAR file
- how to make a JAR file
- update manifest.mf of a jar file
- Read properties file in a jar
- How to Run a .Jar Java File
- uva12504 Updating a Dictionary
- Updating a Dictionary
- 12504 - Updating a Dictionary
- 12504 - Updating a Dictionary
- UVA12504 - Updating a Dictionary
- 12504 - Updating a Dictionary
- UVA12504 Updating a dictionary
- UVA12504--Updating a Dictionary
- Updating a Dictionary
- jar - user of jar command to list/extract file from a jar file
- UVA - 12504 Updating a Dictionary
- Android实现实时视频通话
- jquery 表单验证 提交
- Hive的元数据表结构详解
- C语言回文数简单应用
- PAT 甲级 1134. Vertex Cover (25)
- Updating a JAR File
- Postman使用官方文档翻译--12Debug调试及log相关
- 多进程通信之消息队列
- 生产者/消费者问题Java详解
- java.util.concurrent.Callable
- 欧拉函数板子
- MyBatis学习总结(一)
- mongodb批量改字段类型
- pbzip2: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file