Signup/Sign In

WAR File in Servlet


War stands for Web Application Resource or Web application Archive. A War file have the files of a web project. It can have files like servlet, xml, jsp, image, html, css etc. The main advantage of creating a War file is that it combines all the files of a web project into a single unit and reduces the duration of the file transfer

Following are the steps of creating a War File:


1. Select the web application of which war file is to be created.


war-file

2. Now click on File and select the Export option.


war-file

3. select Web and then click on the WAR file.

Click on Next button


war-file

4. Next, select the destination. The destination of the folder should be


apache-tomcat-9.0.17\webapps


and then click on the finish button.


war-file

We can see the war file is created.

war-file

How to extract the War file?


To extract the war file open cmd. Now In cmd go to the path where the war file is created.

Now enter the below line for extracting all the file from a war file.

jar -xvf Project1.war

war-file
war-file