aspose file tools*
The moose likes Beginning Java and the fly likes view content of file in a jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "view content of file in a jar file" Watch "view content of file in a jar file" New topic
Author

view content of file in a jar file

Herbert Wilson
Greenhorn

Joined: Nov 18, 2003
Posts: 3
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

Joined: Aug 20, 2001
Posts: 1817

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.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Herbert Wilson
Greenhorn

Joined: Nov 18, 2003
Posts: 3
Thanks Joel. Is there an UNIX utility that lets u view the content of the file?
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: view content of file in a jar file