• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's kind of what we've been talking about.
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic