• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I list the content of a file that is packed inside a jar file?  RSS feed

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Kevin Workman
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's kind of what we've been talking about.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!