Difference Between JAR,WAR and EAR

if there are many files and they are dependent in nature for your program. It is very tough to put them in classpath to access them run time.For solving this problem java has come up with archiving concept. It's concept is simple. put all the classes in a zip file and make that available in classpath while running the java code.

Again consider one more example, if our program contains of many HTML files,images files etc. so to download one single file, it is required to download all the components of the file. And for that we require so many HTTP connections to get all those. It will take more time and patience. so zip file is a nice concept .

Mainly we have 3 types of zip file in java..
  1. jar (java archive file)
  2. war (web archive file)
  3. ear (enterprise archive file)

Let's check out the difference between them:

Jar WarEar
  1. contains .class files
  2.  A JAR file encapsulates one or more Java classes, a manifest, and a descriptor.
  3. JAR files are the lowest level of archive
  4. It is having MANIFEST.MF in META-INF folder
  5. extension .jar
  1. it contains mostly web application resources like HTMl,CSS,JSP,Servlets,images,beans etc
  2. It is having web.xml to configure
  3. It helps to maintain,deployment and shipping very easy for web application
  4. extension .war
  1. We use it on enterprise application. mainly combination of wars and jars
  2. It is having xml based deployment descriptor to configure all
  3. It helps to maintain,deployment and shipping very easy for enterprise  application
  4. extension .ear
Difference Between JAR,WAR and EAR Difference Between JAR,WAR and EAR Reviewed by Animesh Chatterjee on May 11, 2013 Rating: 5

No comments:

Powered by Blogger.