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:

         Export dialog

      • Or right click on the project name, select Export > WAR file from context menu:

         export context menu

-          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.

 WAR Export

-          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:


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.



Add comment

   


Comments 

#6José Ilton2024-04-17 12:15
If the field web project is empty? what is your value?
Quote
#5Sivakanthan2021-10-10 12:24
java.lang.NoClassDefFoundError: Could not initialize class com.bookstore.dao.BookDAO
com.bookstore.controller.frontend.HomeServlet.doGet(HomeServlet.java:39)

after host the system getting error like this .
Quote
#4SomeWhoLovesYOU2020-12-03 14:47
Gracias por haber nacido. Un beso
Quote
#3jarvis2016-03-16 01:59
i created war file it gives fake site error
Quote
#2Abhishek Tiwari2015-10-20 02:52
I will appreciate if i will gate update on Data Structure and algorithm.
Quote