File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes j2ee Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "j2ee" Watch "j2ee" New topic



Joined: Oct 07, 2002
Posts: 1
what is the main use of .ear and .war and .jar file?
how it is interrelated, without .ear file,can i run a servlet program in j2ee?

Mahesh Kulkarni
Ranch Hand

Joined: Jul 05, 2001
Posts: 62
Hi raj,
The main use of different files is as follows.
1) .jar(Java archive) file
This is used to create jar for ejb classes(Remote,Home,Implementation) and META-INF. Also jar can be used when you want ship your own classes in .jar format (Eg being j2ee.jar or struts.jar)
2) .war(web archive) file
This is used to create the web archive.This will have all the classes,web.xml other web required files.
3) .ear (Enterprise Archive) file
This is used to combine .war and .jar files for enterprise deployment.
4) .rar (Resource Archive) file
This is used to archive the Resource adapter files (for JCA only).
The major use of this formats is that it helps us to ship the application on different servers.
yes servlet can be run through .war application and also through .ear files
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
Thanks for joining JavaRanch, but could you just take a quick look at the naming policy and edit your profile accordingly.
Bartender (moderator) of "J2EE and EJB" forum
I agree. Here's the link:
subject: j2ee
It's not a secret anymore!