A web module must be packaged into a WAR in certain deployment scenarios and whenever you want to distribute the web module. You package a web module into a WAR by executing the jar command in a directory laid out in the format of a web module, by using the Ant utility, or by using the IDE tool of your choice. This tutorial shows you how to use NetBeans IDE or Ant to build, package, and deploy the sample applications.
To build the hello1 application with NetBeans IDE, follow these instructions:
Select File->Open Project.
In the Open Project dialog, navigate to:
Select the hello1 folder.
Select the Open as Main Project check box.
Click Open Project.
In the Projects tab, right-click the hello1 project and select Build.
To build the hello1 application using the Ant utility, follow these steps:
In a terminal window, go to tut-install/javaeetutorial5/examples/web/hello1/.
Type ant. This command will spawn any necessary compilations, copy files to the tut-install/javaeetutorial5/examples/web/hello1/build/ directory, create the WAR file, and copy it to the tut-install/javaeetutorial5/examples/web/hello1/dist/ directory.