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:
Create JAR "jar -c" Command Syntax
What are syntax rules of the "jar -c" command for creating a JAR file? I am confused on how to specify different options, like v and f.
✍: FYIcenter.com
The "jar -c" command allows you to create a new JAR file. It has the follow syntax:
jar -c[vfmMe0] [jar-file] [manifest-file] [entry-point] list
"v" option flag returns verbose information on standard output for each entry added to the new JAR. If "v" is not specified, nothing shows up on the standard output.
"f" option flag specifies the new JAR file. If "f" is specified, "jar-file" must be provided. If "f" is not specified, the new JAR file is written to the standard output.
"m" option flag specifies the manifest file to be used for the new JAR. If "m" is specified, "manifest-file" must be provided. "M" option flag specifies that no manifest file for the new JAR. If neither "m" nor "M" is specified, a default manifest file will be added to the JAR file.
"e" option flag specifies that the given main class to be added 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 added to the new 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 -c" commands
jar -cf my.jar Hello.class
Create JAR with one class in the current folder
jar -c Hello.class > my.jar
Write the new JAR file to standard output
jar -cf my.jar -C classes . -C bin xyz.class
Create JAR with all files in the "classes" folder
and one class from another folder.
jar -cfm my.jar my.mf Hello.class
Create JAR with one class and my own manifest file
jar -cfe my.jar Hello Hello.class
Create JAR with one class and make it executable
Back to FAQ for JDK JAR (Java ARchive) Tool.
2016-05-22, ∼3767🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
What Is commons-fileupload-1.3.3 .jar?commons-fileupload-1.3.3 .jaris the JAR file for Apache Common...
JDK 17 jdk.localedata.jmod is the JMOD file for JDK 17 Localedata module. JDK 17 Locale Data module ...
The JSR 105 XML Digital Signature 1.0.1 FCS implementation provides an API and implementation that a...
Apache Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead. Bytec...