How to view the contents of java jar files?

Posted by Joys of Programming on in Java

A java jar file is a java archive of class files, media, configuration files and directories. It is very easy to create a jar file. Normally the jar files have the extension .jar.

The option tf is used in conjunction with the command jar is used to view the contents of a jar file

The syntax is as follows


$ jar tf jar-file

Let’s explore the contents of the different jar files created here.


$ jar tf tutorials.jar
META-INF/
META-INF/MANIFEST.MF
tutorials/sutils/StringUtils.class
tutorials/wmessage/WelcomeMessage.class

You can see some additional files like META-INF/MANIFEST.MF. This contain some additional meta information

Let’s see the contents of tutorialswithmedia.jar


$ jar tf tutorialswithmedia.jar
META-INF/
META-INF/MANIFEST.MF
tutorials/sutils/StringUtils.class
tutorials/wmessage/WelcomeMessage.class
media/


Tags: , , , ,

Comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.