What is the difference between EAR, JAR and WAR file?


In J2EE, application modules are packaged as EAR, JAR and WAR based on their functionality.

Each type of file (.jar, .war, .ear) is processed uniquely by application servers, servlet containers, EJB containers, etc

JAR:

Jar file (file with a .jar extension) is the normal Java Application archive and intended to hold generic libraries of Java classes, resources, auxiliary files, etc

This can be added in classpath for compilation and to run java program. Generally in web applications we keep these files in lib directory of the application.

Ex: ojdbc14.jar – This contains all the classes to connect the oracle database

Servlet-api.jar – contains servlet related classes

WAR:

Web modules which contains Servlet class files,JSP Files,supporting files, GIF and HTML files are packaged as JAR file with .war( web archive) extension

War files (files with a .war extension) are intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.

EAR:

All above files(.jar and .war) are packaged as JAR file with .ear ( enterprise archive) extension and deployed into Application Server.

Ear files (files with a .ear extension) are intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web application.

Advertisements
About

I born in Good cultural place called India. My family is traditional family. We fallow all Indian traditions.

Posted in JAVA, JSP, Servlet
6 comments on “What is the difference between EAR, JAR and WAR file?
  1. […] What is the difference between EAR, JAR and WAR file? « Java Tutorials […]

  2. […] What are the differences between EAR, JAR and WAR file? […]

  3. […] What are the differences between EAR, JAR and WAR file? […]

  4. I simply wanted to thank you so much once again. I do not know the things that I would have created without the
    methods shown by you on such a situation. Entirely was an
    absolute intimidating matter in my view, nevertheless viewing
    your professional tactic you handled the issue made me to cry over fulfillment.
    I’m just grateful for your help and thus hope you recognize what a great
    job that you’re putting in training people
    today through the use of a web site. Most probably you have never
    come across any of us.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 678 other followers

Calendar
April 2010
M T W T F S S
« Jul   May »
 1234
567891011
12131415161718
19202122232425
2627282930  
Mallikarjun Gunda

This is Mallikarjun Gunda, I am working as a software professional. Blogging is my Passion. This blog contains the posts on Java related technologies and programming languages. I am happy to share my knowledge through the blogs.

Blog Stats
  • 276,403 hits
IndiBlogger
malliktalksjava.wordpress.c...
70/100