JAR FILES
JAR
stands for Java Archive Page.JAR files
allow to deploy set of classes, interfaces and their associated resources.
- - For
creating a game various resources are required such as sound files for
e.g.(.mp3), image files for e.g. (.png,jpeg.gif, etc.), a programmer can put
all this stuff in a single jar file.
- - Later
this jar file can be deployed to a Bean which controls which file from the
deployed file is to be used when.
- - In
addition, there is one more file called as MANIFEST FILE (.mf) is deployed
which file in jar are Beans.
- - Components
in a jar files are compressed, hence downloading a jar file is easier and
faster than downloading all files separately.
- - All the
games and software majorly on mobile phones and PDAs are deployed using JAR
files.
SYNTAX
jar option file
E.g. for creating a file by name zmn.jar
jar zmn.jar *.class
*.gif
OPTIONS AVAILABLE
c- A new archive is to be created .
C- Changes the directory during command execution.
f- First name in the file list, it is the name of the archive
to be created or accessed.
m- Second element in the file list, it is the name of the external
manifest file.
M- manifest file not created.
t- archive contents should be tabulated.
u- Updates existing jar file.
v- verbose output should be provided by utilities while it
executes.
0-Do not use compression.
x- Files are to be extracted from the archive.
EXAMPLES OF JAR FILES
FOR CREATING A JAR FILE
- If file
az.mft(a manifest file) is present it can be used with following command.
jar cfm
zmn.jar az.mft *.class *.gif
FOR DISLAYING THE CONTENT OF JAR
FILE
jar tf
zmn.jar
TO EXTRACT THE CONTENT OF A JAR
FILE
jar xf
zmn.jar
TO UPDATE THE CONTENT OF JAR FILE
jar uvf
zmn.jar Add.class
TO CREATE A JAR FILE WITH
SPECIFIC-COMPRESSION
jar cvf
zmn.jar D:\\Java\\*.class