How to Make a War File in "NetBeans"


Web applications created in Java are generally ported as Web Application Archive (WAR) files. Once a project has been compressed as a WAR file, it is ready to be deployed on an application server. Most application servers automatically identify WAR files on restart and unpackage its contents into a new directory with the same name as the WAR. At that point, provided that the server is configured properly, the Web application contained in the WAR can be accessed over the Internet. NetBeans automatically creates a WAR file for Java Web applications every time you build your project.

Create a New Web Project

  • Select "File" followed by "New Project" from the menu bar. The "New Project" window appears.

  • Select "Java Web" under the "Categories" options and "Web Application" under the "Projects" options. Click "Next."

  • Name your new project in the "Name and Location" screen. Leave all of the other options set to their default values. Select "Next."

  • Associate your project to the server you will be deploying the WAR file to. It is important that you make the correct selection, as NetBeans will automatically optimize your project for the selected server.

  • Select "Finish." Your new Web application will appear in the "Projects" pane on the left-hand side of the screen.

Creating the WAR File

  • Select "Run" from the NetBeans menu bar.

  • Check under the "Set Main Project" option to see if the project you intend to create a WAR file from is selected. If not, select the project by clicking on it.

  • Select the "Clean and Build Main Project" option under "Run."

  • Select the "Files" tab at the top of the left-hand frame of the NetBeans screen.

  • Select the "+" next to your application directory to expand its contents. You will see a new folder titled "dist."

  • Select the "+" next to the "dist" folder. Within the folder, you will see your newly created WAR file.

Related Searches


  • Photo Credit Hemera Technologies/ Images
Promoted By Zergnet



Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!