A war File contains files of a web project. It have servlet, xml, jsp, image, html, css, js etc. files.
web archive file contains all the contents of a web application. It reduces the time duration for transferring file.
The war file combines all the files into a single unit. So it takes less time while transferring file from client to server.
To create war file, you need to use jar tool of JDK. You need to use -c switch of jar, to create the war file.
First reach inside the web root folder and the give following command:c- create file v- to generate the verbose output f- new folder
first.war file is now created.
There are two ways to deploy the war file.
If you want to deploy the war file in apache tomcat server manually, go to the webapps directory of apache tomcat and paste the war file here.
Now, you are able to access the web project through browser.
Note: server will extract the war file internally.
jar -xvf projectname.war