This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

view content of file in a jar file

 
Herbert Wilson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there a way to view the content of a file that is in a jar file. I can get a list of the files in a jar file by 'jar -tvf name.jar', but is there a way to view the content of a particular file without extracting the jar file.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A jar file is juat a ZIP file. You can open it with any .ZIP utility (such as WinZIP if you're on a Windows platform), and (if the utility lets you -- WinZIP does), view the files there.
 
Herbert Wilson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joel. Is there an UNIX utility that lets u view the content of the file?
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On unix/linux you can do the following, to extract foo.java from name.jar:
jar xf foo.java < name.jar
That will write foo.java to stdout.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic