Java archives and Beans

This module shows you how to use the Java Archive (JAR) utility that comes standard with the JDK to examine JAR files and package Beans in them.

Module Learning Objectives

After completing the module, you will have the knowledge and skills necessary to:

Examine existing JAR files with the JAR utility

Package Beans in JAR files for distribution

In the next lesson, you examine how Java archives are used to package and distribute JavaBeans components.

jar Program

The jar program is provided as part of the JDK. It can be used to create JAR files, extract some or
all of their contained elements, and list their contents. The jar program is executed from the
command-line prompt. Its usage is:

jar {ctx}[vfm0M] [jar-file] [manifest-file] files ...

One, and only one, of the required command-line options (c, t, or x) can be selected at a time.
The rest of the options can be combined or omitted as needed.
The optional jar-file argument is used to specify the name of the archive file.
This argument should be specified when the command-line option f is used.
There is no required naming convention for JAR files.
They can use any naming style, and use any file extension supported by the native operating system.
However, the tools that use JAR files are free to mandate their own naming conventions.
The optional manifest-file argument is used to specify the name of a file that contains the manifest information to be used for the archive.
The manifest-file should be specified when the commandline option m is used.