Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Update JAR "jar -u" Command Syntax
What are syntax rules of the "jar -u" command for updating a JAR file? I am confused on how to specify different options, like v and f.
✍: FYIcenter.com
The "jar -u" command allows you to update an existing JAR file. It has the follow syntax:
jar -u[vfme0] [jar-file] [manifest-file] [entry-point] [list]
"v" option flag returns verbose information on standard output for each entry added to the existing JAR. If "v" is not specified, nothing shows up on the standard output.
"f" option flag specifies the existing JAR file. If "f" is specified, "jar-file" must be provided. If "f" is not specified, the exiting JAR file is read from standard input, and the updated JAR file is written to the standard output.
"m" option flag specifies the manifest file to be merged into the JAR. If "m" is specified, "manifest-file" must be provided.
"e" option flag specifies that the given main class to be used to update in the manifest to make the new JAR executable. If "e" is specified, "entry-point" must be provided.
"0" option flag specifies that new entries to be added with no compression.
"list" must be provided to specify a list of files to be used to update the JAR. If an entry in the "list" is a folder, all files in that folder will be added. If "-C dir entry" appears in the list, the "jar" command will change to the given directory (folder) first before process the entry.
Here are some example of valid "jar -u" commands
jar -uf my.jar Hello.class
Update JAR with one class in the current folder
type old.jar | jar -u Hello.java > new.jar
Read the old JAR from standard input
and write the new JAR to standard output
jar -uf my.jar -C classes . -C bin xyz.class
Update JAR with all files in the "classes" folder
and one class from another folder.
jar -ufm my.jar my.mf Hello.class
Update JAR with one class and merge the manifest file
jar -ufe my.jar Hello
Update JAR with the main class to make it executable
Back to FAQ for JDK JAR (Java ARchive) Tool.
2016-05-15, ∼4273🔥, 0💬
Popular Posts:
How to download and install JDK (Java Development Kit) 5? If you want to write Java applications, yo...
JDK 17 java.sql.rowset.jmod is the JMOD file for JDK 17 SQL Rowset module. JDK 17 SQL Rowset module ...
jlGui is a music player for the Java platform. It is based on Java Sound 1.0 (i.e. JDK 1.3+). It sup...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
What Is jaxb-api-2.1.6.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Java ...