The jar tool is provided as part of the Java SDK. The jar tool combines multiple files into a single jar archive file. jar files are compressed, like ZIP files, and can contain class files, serialized files, data files, images, and so on. This makes for convenient installation and distribution of files, and as we can include jar files in a classpath list. In the following example:
jar cvf myjar Class1 Class2
cvf are jar options, indicating c, which creates a new or empty archive; v, which generates verbose output; and f, which specifies a jar file name, myjar in the example.
The jar tool automatically creates a manifest file, META-INF/MANIFEST.MF, which contains metadata describing the archive and is the first entry in the jar file. There are many options in the jar tool, for example, extracting files from an archive, listing contents of a jar file, and incorporating a customized manifest file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment