Author
How do I list the content of a file that is packed inside a jar file?
Rogerio Kioshi
Ranch Hand
Joined: Apr 12, 2005
Posts: 659
Hi,
I'd like to know if there is a way to list the content of a file (an xml file, for instance) that is packed inside a jar file.
Is there an option in jar command line to do this?
SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Kevin Workman
Ranch Hand
Joined: Sep 28, 2010
Posts: 151
Rogerio Kioshi wrote: Hi,
I'd like to know if there is a way to list the content of a file (an xml file, for instance) that is packed inside a jar file.
Is there an option in jar command line to do this?
This is the first result when I googled "jar view contents": http://java.sun.com/developer/Books/javaprogramming/JAR/basics/view.html
Is that what you mean?
Rogerio Kioshi
Ranch Hand
Joined: Apr 12, 2005
Posts: 659
Kevin Workman wrote:
Rogerio Kioshi wrote: Hi,
I'd like to know if there is a way to list the content of a file (an xml file, for instance) that is packed inside a jar file.
Is there an option in jar command line to do this?
This is the first result when I googled "jar view contents":
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/view.html
Is that what you mean?
Not exactly. I'll explain: I have a file called persistence.xml inside the folder META-INF. This folder is packed in a jar file. What I wanted to do is that, from a command line, I could see what is written in the persistence.xml file. It would be like doing a "cat pesristence.xml", without having to unzip the jar file. I hope it is clearest to understand, now...
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Sep 30, 2010 10:25:36
0
No, but you could extract just that file. Or use any of the normal zip applications to open it in a file viewer.
Rogerio Kioshi
Ranch Hand
Joined: Apr 12, 2005
Posts: 659
David Newton wrote: No, but you could extract just that file. Or use any of the normal zip applications to open it in a file viewer.
That's the way I'm doing, but I wanted to avoid opening the jar file all the time.
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Sep 30, 2010 10:41:16
0
No real way around that--it's in a jar file. *Something* will have to open it, but it's invisible in most OSes with appropriate explorer plugins.
Ireneusz Kordal
Ranch Hand
Joined: Jun 21, 2008
Posts: 423
Jar is an ordinary ZIP archive, you can exctract/view files using ZIP tools.
Simple example - commands issued from the linux console:
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
posted Sep 30, 2010 16:29:50
0
That's kind of what we've been talking about.
subject: How do I list the content of a file that is packed inside a jar file?