Java - List files in a JAR file on the command line

by
Jeremy Canfield |
Updated: March 23 2022
| Java articles
The JAR command is include in some, but not all installations of Java. On a Linux system, the which command can be used to determine if the JAR command is part of your $PATH. If something like this is returned, you may need to install Java on your Linux system.
~]# which jar
/usr/bin/which: no jar in (/sbin:/bin:/usr/sbin:/usr/bin)
The JAR command with the f (file name) and t (list table of contents) flags can be used to list the files in a .jar file.
~]# jar tf example.jar
META-INF
META-INF/MANIFEST.MF
/var/www/html
/var/www/html/index.html
/var/www/html/about.html
Did you find this article helpful?
If so, consider buying me a coffee over at