Linux command jar to display a list of java files

Linux command jar to display a list of java files

While the contents of a war file can be displayed with the zipinfo or less command, the list of files in a jar file can be displayed with the jar command.

jar tf a.jar

You will now see a list of jar files.

jp/co/confrage/a.class
jp/co/confrage/b.class
jp/co/confrage/c.class

The options for the jar command are as follows. See the man command for details.

OptionsMeaning
tList the contents of the archive
fSpecify the archive file name
vdisplay process contents on command line

If the “tf” option is used, information such as file size and date will also be added to the display.

If you want to know the file size of a certain class, you can check the file size as follows.

jar tvf | grep hoge.class

コメント

タイトルとURLをコピーしました