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/
Comments: