How to Create War File in Servlet


Prev Tutorial Next Tutorial

How to Create War File in Servlet

A war (web archive) File is a compressed format of files of a web project. It may have servlet, xml, jsp, image, html, css, js etc.

Advantage of war file

Saves time: The war file combines all the files into a single unit. It is a compressed format of all files, So it takes less time while transferring file from client to server.

How to create war file?

To create war file, we need jar tool of JDK. We need to use -c switch of jar, to create the war file.

Go inside the project directory of your project (outside the WEB-INF), then write the following command:

Syntax

jar -cvf projectname.war *  

Here, -c is used to create file, -v to generate the verbose output and -f to specify the archive file name.

The * (asterisk) symbol signifies that all the files of this directory (including sub directory).

How to extract war file manually?

To extract the war file, you need to use -x switch of jar tool of JDK. Let's see the command to extract the war file.

Syntax

jar -xvf projectname.war  

Note: Server will extract the war file internally.


Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements