This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are ear,war and jar files ?

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EAR is enterprise archive file

WAR is webarchive file

JAR is javaarchive file. I would like to know the difference between WAR and JAR. Can i say WAR is nothing but JAR in zip format ?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jose chiramal wrote:Can i say WAR is nothing but JAR in zip format ?

No, that's not where the difference is. EAR, WAR and JAR files are all essentially just JAR files, but in EAR and WAR files there are some special configuration files stored inside the EAR or WAR, which a Java EE application server or servlet container uses to deploy the application inside the EAR or WAR.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jose chiramal wrote:Can i say WAR is nothing but JAR in zip format ?

Jesper is right. In fact, JAR is just the same. All are just ZIP files with special files and folders inside. For JAR that is the META-INF folder and the META-INF/MANIFEST.MF file. WAR files have these as well, and add the WEB-INF folder and WEB-INF/web.xml file. No idea about EAR but like WAR it's a JAR file with extra files and folders.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to what Rob mentioned, EAR files assemble the WAR, JAR and other similar component artifacts together. So typically inside and .ear file, you will see a .war and .jar files. A .ear file can also have a META-INF/application.xml.
 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does META-INF have can i say the version number or sthg??


Application.xml has the context root etc right ?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Files such as WEB-INF/web.xml and META-INF/application.xml are deployment descriptors - files that contain the configuration of web applications and enterprise applications. If you want to know exactly what those files look like, then look at the schemas and DTDs for them.

Also see the Java EE 6 Tutorial.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic