How to Create War File in Servlet

Advertisements

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 Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements