What is war file?
WAR stands for Web application Archive. WAR is a compressed file format like the ZIP file which includes jsp, servlet, jar and static web resources etc in a specific hierarchical directory structure called WEB-INF. It is like jar file but follow a specific hierarchical directory structure. WAR files are deployed to the application server like Tomcat or Java EE server like JBoss etc.
Note: WAR files have the .war extension and contains the whole web application.
How to create WAR file in eclipse?
Let us discuss it with an example. We are creating a java project which contain one class ArmstrongNumber.java. The ArmstrongNumber.java contains one static method armstrong(int num) which returns true if the num is an armstrong number otherwise returns false. We will create the JAR file of this and use JAR file in other project.
Step 1: Right click on the project and click on Export.
Step 2: Select the WAR file and click on Next.
Step 3: Enter the destination and click on Finish.
Related Topics: