In order to compress a ‘pets’ servlet/web application/project into a "Web Archive" file named pets.war which can easily be imported in Eclipse or other IDE”s or can easily be transported to another server, Execute the following commands in the terminal:
[ad#g-horz-textimg-468]
1: cd \webapps\pets
2:
3: // Use the java archive command 'jar' to bundle up your application
4: // compress everything in this directory into a file named pets.war
5: // (c=create, v=verbose, f=file)
6:
7: jar -cvf pets.war *
Now you can copy pets.war to any webapps directory on a new Tomcat Server. If Tomcat is running, the war file will be automatically decompressed and a web application named ‘pets’ will be created in the appropriate directory as soon as you save it!!
Please let me know if it helps :).