Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indexing a JAR file

1 view
Skip to first unread message

Daniel Grieves

unread,
Jul 5, 2000, 3:00:00 AM7/5/00
to
(My apologies for the poor formatting of this message. The pipe symbol
'|' is used to mark screen captures.)

Has anyone been able to figure out how to use the -i option on the jar
program? I tried it as I create the file:

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>jar cvimf
..\manifest.t
|xt BSCTool2.jar *
|java.io.FileNotFoundException: BSCTool2.jar (The system cannot find the
file spe
|cified)
| at java.io.FileInputStream.open(Native Method)
| at java.io.FileInputStream.<init>(FileInputStream.java:64)
| at sun.tools.jar.Main.run(Main.java:124)
| at sun.tools.jar.Main.main(Main.java:904)

Well obviously the jar file doesn't exist, I'm trying to create it. So
I try it again after I've created the file:

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>jar cvif
BSCTool2.jar
|Usage: jar {ctxu}[vfm0M] [jar-file] [manifest-file] [-C dir] files ...
|Options:
| -c create new archive
| -t list table of contents for archive
| -x extract named (or all) files from archive
| -u update existing archive
| -v generate verbose output on standard output
| -f specify archive file name
| -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 the 'm' and 'f' flags are specified.
|
|Example 1: to archive two class files into an archive called
classes.jar:
| jar cvf classes.jar Foo.class Bar.class
|Example 2: use an existing manifest file 'mymanifest' and archive all
the
| files in the foo/ directory into 'classes.jar':
| jar cvfm classes.jar mymanifest -C foo/ .

Ok, lets try without the c:

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>jar ivf
BSCTool2.jar

Does the same thing. Now I try to update the file (even though it
doesn't need updating):

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>jar uivf
BSCTool.jar bs
|c.class
|'u' flag requires manifest or input files be specified!


So has anyone gotten the blasted thing to work? And what does it do,
anyway? This bugger has me really curious now.

Dan


Jim Sculley

unread,
Jul 5, 2000, 3:00:00 AM7/5/00
to
Daniel Grieves wrote:
>
> (My apologies for the poor formatting of this message. The pipe symbol
> '|' is used to mark screen captures.)
>
> Has anyone been able to figure out how to use the -i option on the jar
> program? I tried it as I create the file:
>

<snip>

>
> Well obviously the jar file doesn't exist, I'm trying to create it.

Makes sense.


> So I try it again after I've created the file:
>

<snip>

>
> So has anyone gotten the blasted thing to work? And what does it do,
> anyway? This bugger has me really curious now.

From the SDK docs:
(http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jar.html#Options)

i
Generate index information for the specified jar file and its
dependent jar files. For example,

jar -i foo.jar

would generate an INDEX.LIST file in foo.jar which contains location
information for each package
in foo.jar and all the jar files specified in foo.jar's Class-Path
attribute.

And that's what it appears to do on my machine. If I use

jar -i Tidy.jar

it stuffs an 'index.list' file in the JAR (in the meta-inf directory)
with the following content:

JarIndex-Version: 1.0

d:\jazilla\libraries\Tidy.jar
org/w3c/tidy
org/w3c/dom


Jim S.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

Daniel Grieves

unread,
Jul 6, 2000, 3:00:00 AM7/6/00
to
Ok, here's my .jar file:

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>dir *.jar
| Volume in drive C is Mountain
| Volume Serial Number is C835-8BFC
|
| Directory of C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes
|
|07/05/00 03:55p 42,896 BSCTool2.jar
| 1 File(s) 42,896 bytes
| 409,596,928 bytes free

So I try to put in an index file:

|C:\WINNT\Profiles\cdg027c.000\Personal\MikeQuick\classes>jar -i BSCTool2.jar

|java.util.zip.ZipException: The system cannot find the file specified
| at java.util.zip.ZipFile.open(Native Method)
| at java.util.zip.ZipFile.<init>(ZipFile.java:110)
| at java.util.jar.JarFile.<init>(JarFile.java:115)
| at java.util.jar.JarFile.<init>(JarFile.java:57)
| at sun.tools.jar.Main.getJarPath(Main.java:794)
| at sun.tools.jar.Main.getJarPath(Main.java:810)
| at sun.tools.jar.Main.genIndex(Main.java:828)
| at sun.tools.jar.Main.run(Main.java:197)
| at sun.tools.jar.Main.main(Main.java:904)

What did I do wrong? Even supposing this had worked, what good does it
accomplish?

Dan

0 new messages