{"id":366,"date":"2007-10-21T00:00:00","date_gmt":"2007-10-21T00:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=366"},"modified":"2007-10-21T00:00:00","modified_gmt":"2007-10-21T00:00:00","slug":"Viewing the Contents of a JAR File","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=366","title":{"rendered":"Viewing the Contents of a JAR File"},"content":{"rendered":"<p><DIV><br \/>\n<DIV id=PageTitle>Viewing the Contents of a JAR File<\/DIV><br \/>\n<BLOCKQUOTE>The basic format of the command for viewing the contents of a JAR file is:<br \/>\n<BLOCKQUOTE><PRE>jar tf <I>jar-file<\/I><br \/>\n<\/PRE><\/BLOCKQUOTE>Let&#8217;s look at the options and argument used in this command:<br \/>\n<UL><br \/>\n<LI>The <TT>t<\/TT> option indicates that you want to view the <EM>table<\/EM> of contents of the JAR file. <\/LI><br \/>\n<LI>The <TT>f<\/TT> option indicates that the JAR file whose contents are to be viewed is specified on the command line. <\/LI><br \/>\n<LI>The <TT>jar-file<\/TT> argument is the path and name of the JAR file whose contents you want to view. <\/LI><\/UL><br \/>\n<P>The <TT>t<\/TT> and <TT>f<\/TT> options can appear in either order, but there must not be any space between them. <\/P><br \/>\n<P>This command will display the JAR file&#8217;s table of contents to stdout. <\/P><br \/>\n<P>You can optionally add the verbose option, <TT>v<\/TT>, to produce additional information about file sizes and last-modified dates in the output. <\/P><\/BLOCKQUOTE><br \/>\n<H3>An Example<\/H3><br \/>\n<BLOCKQUOTE>Let&#8217;s use the Jar tool to list the contents of the <TT>TicTacToe.jar<\/TT> file we created in the previous section:<br \/>\n<BLOCKQUOTE><PRE>jar tf TicTacToe.jar<br \/>\n<\/PRE><\/BLOCKQUOTE><br \/>\n<P>This command displays the contents of the JAR file to stdout: <\/P><br \/>\n<BLOCKQUOTE><PRE>META-INF\/MANIFEST.MF<br \/>\nTicTacToe.class<br \/>\naudio\/<br \/>\naudio\/beep.au<br \/>\naudio\/ding.au<br \/>\naudio\/return.au<br \/>\naudio\/yahoo1.au<br \/>\naudio\/yahoo2.au<br \/>\nimages\/<br \/>\nimages\/cross.gif<br \/>\nimages\/not.gif<br \/>\n<\/PRE><\/BLOCKQUOTE><br \/>\n<P>The JAR file contains the <TT>TicTacToe<\/TT> class file and the audio and images directory, as expected. The output also shows that JAR file contains a default manifest file, <TT>META-INF\/MANIFEST.MF<\/TT>, which was automatically placed in the archive by the JAR tool. For more information, see the <A class=TutorialLink href=\"http:\/\/www.strongd.net\/blog\/show\/359\" target=_top>Understanding the Default Manifest<\/A> section. <\/P><br \/>\n<P>All pathnames are displayed with forward slashes, regardless of the platform or operating system you&#8217;re using. Paths in JAR files are always relative; you&#8217;ll never see a path beginning with <TT>C:<\/TT>, for example. <\/P><br \/>\n<P>The JAR tool will display additional information if you use the <TT>v<\/TT> option: <\/P><br \/>\n<BLOCKQUOTE><PRE>jar tvf TicTacToe.jar<br \/>\n<\/PRE><\/BLOCKQUOTE><br \/>\n<P>For example, the verbose output for the TicTacToe JAR file would look similar to this: <\/P><br \/>\n<BLOCKQUOTE><PRE> 256 Mon Apr 18 10:50:28 PDT 2005 META-INF\/MANIFEST.MF<br \/>\n3885 Mon Apr 18 10:49:50 PDT 2005 TicTacToe.class<br \/>\n   0 Wed Apr 20 16:39:32 PDT 2005 audio\/<br \/>\n4032 Wed Apr 20 16:39:32 PDT 2005 audio\/beep.au<br \/>\n2566 Wed Apr 20 16:39:32 PDT 2005 audio\/ding.au<br \/>\n6558 Wed Apr 20 16:39:32 PDT 2005 audio\/return.au<br \/>\n7834 Wed Apr 20 16:39:32 PDT 2005 audio\/yahoo1.au<br \/>\n7463 Wed Apr 20 16:39:32 PDT 2005 audio\/yahoo2.au<br \/>\n   0 Wed Apr 20 16:39:44 PDT 2005 images\/<br \/>\n 157 Wed Apr 20 16:39:44 PDT 2005 images\/cross.gif<br \/>\n 158 Wed Apr 20 16:39:44 PDT 2005 images\/not.gif<br \/>\n<\/PRE><\/BLOCKQUOTE><\/BLOCKQUOTE><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Viewing the Contents of a JAR File The basic format of the command for viewing the contents of a JAR file is: jar tf jar-file Let&#8217;s look at the options and argument used in this command: The t option indicates that you want to view the table of contents of the JAR file. The f &hellip; <a href=\"https:\/\/www.strongd.net\/?p=366\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Viewing the Contents of a JAR File<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=366"}],"version-history":[{"count":0,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/366\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}