♠ Posted by Unknown in Adv Java at 01:01
What is JAR files?
A JAR file allows
you to efficiently deploy a set of classes and their associated resource. For example, a developer may build a
multimedia application that uses various sound and image files. A set of Beans
can control how and when this information is presented. All these pieces can be
placed into one JAR files.
JAR technology makes it much easier to deliver and
install software. Also, the elements in a JAR file are compressed, which makes
downloading a JAR file much faster than separately downloading several uncompressed
files. Digital signatures may also be associated with the individual elements
in a JAR file. This allows a consumer to be sure that a specific organization
or individual produced these elements.
Note : The package java.util.zip
contains classes that read write JAR files.
Manifeast Files :
A developer must provide a manifest file to indicate
which of the components in a Jar file are Java Beans. A manifest file may
reference several .class files. If a .class file is a Java Bean, its entry must
be immediately followed by the line “Java-Bean: True”.
Introspection :
Introspection is the process of analyzing a Bean to
determine its capabilities. This is an essential feature of the Java Beans API,
because it allows an application builder tool to present information about a
component to a software designer. Without introspection, the Java Beans
technology could not operate.
There are two ways in which the developer of a Bean
can indicate which of its properties, events, and methods should be exposed by
an application builder tool. With the first method, simple naming conventions
are used. these allow the introspection mechanisms to infer information about a
Bean. In the second way, an additional class is provided that explicitly
supplies this information.
The JAR Utility :
A utility is used to generate a JAR file. Its syntax
is shown here:
jar
option files
Option
|
Description
|
c
|
A new archive is to be
created.
|
C
|
Change directories
during command execution.
|
f
|
The first element in
the file list is the name of the archive that is to be created or accessed.
|
i
|
Index information
should be provided.
|
M
|
The second element in
the file list is the name of the external manifest file.
|
M
|
Manifest file not
created.
|
t
|
The archive contents
should be tabulated.
|
u
|
Update existing JAR
file.
|
v
|
Verbose output should
be provided by the utility as it executes.
|
x
|
Files are to be
extracted from the archive. (If there is only one file, that is the name of
the archive, and all files in ti are extracted. Otherwise, the first element
in the file list is the name of the archive, and the remaining elements in
the list are the files that should be extracted from the archive.)
|
0
|
Do not use
compression.
|
Creating a JAR file :
The following command creates a JAR file named
xyz.jar that contains all of the .class and .gif files in the current
directory:
jar
cf xyz.jar *.class *.gif
0 comments:
Post a Comment