Most people familiar with Java Applets and Java class libraries are familiar with the concept of .jar files.Most of the time, Java libraries are distributed in jar files. For example: the JDOM XML library is distributed in a file named jdom.jar. Snowbound's FlexSnapSI Applet is packaged in a file named FlexSnapSI.jar.
JAR is short for "Java Archive" and it is a cute name, but perhaps an unfortunate one, because jar files are really just renamed zip files. I've had people ask if I could make a jar file for them from their class folders. All you really need is Winzip or a similar program. More on the basics of Jar Files can be found in this Java tutorial. You can easily unzip the contents of a jar file to see the classes that are included in a library or applet package.
EARs and WARs:
J2EE Servlet based web applications that run in Tomcat or Websphere are usually distributed as .war files. In this case, WAR stands for "Web Application Archive". Like jar files, they are in .zip format. To create one, you can use a zip program to create a file called myapp.zip and then simply rename it to myapp.war. Depending on your application server, they are often expanded at deployment time and converted to a folder structure.
Ear files take this one step further. In my experience,. an .ear file is just a zipped up .war, which is already a zip to begin with. So now we have a zip within a zip. I usually drive myself crazy when I'm trying to package up an .ear file for use in Websphere. A good discussion on the topic is found in this SearchWebServices.com Q&A.
-Alex
Comments