Following steps need to be followed to create WAR file in Eclipse.

Step 1: Right click on the project and go the property option

Step 2: Go for the tomcat option

Step 3: Go for the ‘Export to the WAR Setting’ tab and click on the browse button to select the destination directory

Step 4: Select the directory and give the name of the WAR file.

Step 5: Now right click on the project and go for the ‘Tomcat Project->Export to the WAR file sets in project properties’ for exporting the WAR file.