CuriousMind
CuriousMind

Reputation: 8903

Seeing contents of war file without extracting

I created a simple web application and deployed in Tomcat using the admin console of Tomcat. Now, this war files gets stored in tomcat location under webapps directory.

Is there a way to see the contents of this war without extracting? I know we can see the contents of war file by extracting using jar -xvf ; however is there any tool/mechanism by which to see the contents of war files without extracting it?

Thanks for your time!

Upvotes: 17

Views: 30142

Answers (3)

Henri Johansson
Henri Johansson

Reputation: 31

Verbose version of matts answer

You can use jar command.

It is a general-purpose archiving and compression tool.

  • The t option or --list Lists the table of contents for the archive.

  • The f option or -f FILE or --file=FILE Specifies the archive file name.

so the complete command in this case is

jar tf the-file.war

More options and details can be found from docs here: https://docs.oracle.com/en/java/javase/21/docs/specs/man/jar.html

Upvotes: 2

Logan
Logan

Reputation: 59

A little late to the party, but you can use 7-zip or other similar software to view the contents of the .war

With 7-zip:
Right click on file.war -> Open archive

Upvotes: 4

matt
matt

Reputation: 79723

The t option to the command line jar program will list the contents of a jar (or war) file, e.g.:

$ jar tf the-file.war

Upvotes: 23

Related Questions