Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Diff. Btwn EAR, WAR, & JAR Files????

Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I'm a little confused on where EAR, WAR, & JAR files can run. I'm working on an application in which an application server farm group requires us to package our service in an EAR file. That's fine. But now I would like to ask about what is the best way to package our client packages. For one pacakage the client will only make event calls, so there will not be any java processes continuously running. For the other, we need java processes to run to continuously listen to a queue. There are no web requirements. The trick is that we cannot guarentee that all of our clients will be using application servers. Therefore, we need to package it in a way so that it will just run on a JVM. Can the JVM run EAR and WAR files? Or, do we have to have 2 different package options to accomodate client setups?

Thanks in advance for any assistance.

author and iconoclast
Posts: 24204
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EAR, WAR, and JAR files are all PKZIP-format files containing a META-INF directory with a MANIFEST.MF file in it. Beyond that, EAR and WAR files have some additional requirements. WAR files contain a WEB-INF directory with a web.xml file in it; I can't tell you off the top of my head what's in an EAR file, but it's something similar.

Anyway, a runnable JAR file has a special entry "Main-Class" in the MANIFEST.MF file that tells how to run the file. If you put such an entry in a WAR or EAR file's manifest, the command-line "java.exe" will be able to run it -- the name doesn't matter. So I believe that this is possible.
Java Cowboy
Posts: 16084
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EAR (Enterprise Application Archive) and WAR (Web Application Archive) files are special kinds of JAR files.

You need a J2EE application server to run EAR files.
You need a servlet container or J2EE app server to run WAR files.

Which kind you should use depends on your application. If it's a J2EE application with EJBs (Enterprise Java Beans), you need to build an EAR file and deploy it in your app server. If it's a web application with servlets and JSPs but without EJBs, you can build a WAR file and deploy it in the servlet container.

A plain JVM cannot run EAR and WAR files.
Popeye has his spinach. I have this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic