Java Glossary : Jar.exe

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : J words : Jar.exe.

Jar.exe
Sun's tool for building jar files.

Usage:

jar {ctxu}[vfm0M] [jar-file] [manifest-file] [-C dir] files ...

-c create new jar rather than update existing one.
-t list table of contents for jar.
-x extract named (or all) files from jar.
-u update existing jar.
-v generate verbose output on standard output.
-f specify jar file name (always needed).
-m include manifest information from specified manifest file.
-0 store only; use no ZIP compression.
-M do not create a manifest file for the entries.
-i generate index information for the specified jar files.
-C change to the specified directory and include the following file.
If any file is a directory then it is processed recursively. The manifest file name and the archive file name needs to be specified in the same order that the 'm' and 'f' flags are specified. You will be safe if you always put the options in standard order and put the files in standard order.

Specify all the qualification you want included in the jar to get the proper package names and set your default directory appropriately : e.g.


view

Avoid C:\ on the class files to be included, or the C:\ may be included as part of the package name.

The jar.exe file itself lives in J:\j2sdk1.4.2_04\bin\jar.exe.

forjar.list

If you get too many jar files to include on the command line, you can put the overflow in a forjar.list file like this all on one line:
/com/mindprod/jdisplay/JDisplay$1.class
/com/mindprod/jdisplay/JDisplay$2.class
/com/mindprod/jdisplay/JDisplay$3.class
/com/mindprod/jdisplay/JDisplay$4.class
/com/mindprod/jdisplay/JDisplay.class
/com/mindprod/jdisplay/Keyword.class
Unlike the command line you can't use wildcards and you must use / instead of \. You invoke it all one line like this:

CD C:\
jar.exe -cvfm com\mindprod\bulk\bulk.jar com\mindprod\bulk\main.mft com\mindprod\bulk\*.class @forjar.list


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 5333.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/jarexe.html J:\mindprod\jgloss\jarexe.html