How to create WAR file for Java web application in Eclipse
- Details
- Written by Nam Ha Minh
- Last Updated on 07 August 2019   |   Print Email
In Java enterprise development, WAR (Web ARchive) is the standard container file format for packaging Java EE applications as a single, deployable unit which can be deployed on Java EE-compliant application servers like Tomcat, JBoss, Glassfish...
Eclipse IDE provides robust development environment for Java EE applications, including the ability to package and create WAR file. Following are the steps to create WAR file for a Java dynamic web project in Eclipse:
- Select project name in the Project explorer view, we can access the export WAR function by either:
- Click File > Export… from main menu (shortcut: Alt + F + O), then select WAR file in the Exportdialog like in the following screenshot:
- Or right click on the project name, select Export > WAR file from context menu:
- Click File > Export… from main menu (shortcut: Alt + F + O), then select WAR file in the Exportdialog like in the following screenshot:
- The WAR Export dialog appears, we have to specify two required information:
- Web Project: Select the Java dynamic web project to export. The currently selected project is displayed as default.
- Destination: Specify path of the WAR file to be exported. The file must end with “.war” extension.
- In addition, there are three optional checkboxes:
- Optimize for a specific server runtime: Let Eclipse optimize the generated WAR file for a server runtime environment. Don’t check if you are not sure which server on which the WAR file will be deployed.
- Export source files: include Java sources file in the generated WAR file. This is usually left unchecked.
- Overwrite existing file: overwrites if the specified WAR file already exists. This option is checked by default.
Now click Finish then Eclipse will create the desired WAR file.
Related Tutorials:
Other Eclipse Tutorials:
- How to use Eclipse IDE for Java EE Developers
- How to create, build and run a Java Hello World program with Eclipse
- How to change font for Java code in Eclipse
- How to Add Copyright License Header for Java Source Files in Eclipse
- How to generate Javadoc in Eclipse
- How to pass arguments when running a Java program in Eclipse
- How to create Java web project with Maven in Eclipse
- 25 Eclipse Shortcut Keys for Code Editing
- How to add custom Ant build script to Eclipse project
Comments
com.bookstore.controller.frontend.HomeServlet.doGet(HomeServlet.java:39)
after host the system getting error like this .