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?
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.
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.