In order to create a WAR file, use JDK's JAR tool. Use -c switch of jar for creating the war file. Enter the project directory of your project and write this command: jar -cvf projectname.war * Here, -c is for creating file, -v for generating verbose output and -f for specifying name of the archive file.

BY Best Interview Question ON 19 Jan 2019