How to Make a War File in "NetBeans"

Written by corey bieber
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Make a War File in "NetBeans"
NetBeans enables software developers to create WAR files to port Java Web applications. (Hemera Technologies/ Images)

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.

Skill level:


    Create a New Web Project

  1. 1

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

  2. 2

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

  3. 3

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

  4. 4

    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 optimise your project for the selected server.

  5. 5

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

    Creating the WAR File

  1. 1

    Select "Run" from the NetBeans menu bar.

  2. 2

    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.

  3. 3

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

  4. 4

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

  5. 5

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

  6. 6

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

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.