How to list (from command line) all files in a "jar" archive ?

T

Thomas Stien

I thought

jar -t myarchive.jar

resp

jar -t myarchive.jar *.*

will do the job. But when I entered exactly this command at the command prompt then
there is NO response from jar.exe. It keeps on running without any output.

How do I list all files in a jar archive with a command line command oterhwise ?

Thomas
 
A

Anthony Borla

Thomas Stien said:
I thought

jar -t myarchive.jar

resp

jar -t myarchive.jar *.*

will do the job. But when I entered exactly this command at
the command prompt then there is NO response from jar.exe.
It keeps on running without any output.

How do I list all files in a jar archive with a command line
command oterhwise ?

Did you try:

jar -tf myarchive.jar *.*

or:

jar tf myarchive.jar *.*

Typing 'jar' on its own will dump help text on the console.

I hope this helps.

Anthony Borla

P.S.

For what it is worth, the UNIX 'tar' command [I wonder if they are related
;) ?] behaves in a similar manner - until you use the 'f' option to nominate
a file, it just happily 'waits', seemingly in limbo - and has caught me out
on more than one occasion.
 
G

Glenn McCall

For what it is worth, both tar and jar will take there "input" from standard
input if you don't use the "f" option.
For example:
jar -tf myarchive.jar

jar -t < myarchive.jar
and
type myarchive.jar | jar -t (or cat myarchive.jar |
jar -t)

will all produce the expected output.
 
A

Anthony Borla

Glenn McCall said:
For what it is worth, both tar and jar will take there "input"
from standard input if you don't use the "f" option.
For example:
jar -tf myarchive.jar

jar -t < myarchive.jar
and
type myarchive.jar | jar -t (or cat myarchive.jar | jar -t)

will all produce the expected output.

Yes, absolutely, your'e quite right :) !

However the OP was using neither piping nor I/O redirection, and the
response given addressed the specific problem of why the 'jar' command
seemed to 'freeze' when a filename was supplied as a command argument.

Cheers,

Anthony Borla
 
N

n@th@n

Thomas said:
I thought

jar -t myarchive.jar

resp

jar -t myarchive.jar *.*

will do the job. But when I entered exactly this command at the command prompt then
there is NO response from jar.exe. It keeps on running without any output.

How do I list all files in a jar archive with a command line command oterhwise ?

Thomas

Thomas,

You need to specify the file with the -f flag....Try this:

jar -tf myarchive.jar

Hope this helps,

-nathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top