WAR file vs EAR file



What is the difference between a .war and .ear file?

In a JEE application, modules are packaged as EAR, JAR and WAR based on what they are set out to do.

JAR: EJB modules are modules that contain enterprise java beans (Stateful-, Stateless or Singletons) and are packed as JAR files with .jar extenstion

WAR: Web modules which contain Servlet class files, JSP Files, static files like GIF, JPG, PNG and HTML files are packaged as a WAR file (web archive). A WAR file is a jar with different extension.

EAR: An EAR-file is also a jar file but with the .ear extension, which contains all modules in the application (jar and war) and in addition it can also contain jar files that the application is dependant of (if the choice is made to pack them with the application). The ear-file is deployed to an application server like JBoss, Websphere, Weblogic or Glassfish (among others).







Search for more Java info on this site here:
Custom Search


Please type any questions here.