Archive - Originally posted on "The Horse's Mouth" - 2006-06-10 07:05:15 - Graham Ellis
Have you ever wondered why that are so many file extensions ending in "a r"? It's because the "ar" stands for archive, and it's such a reasonable way of naming file that the original tar which stands for tape archive was picked up by Sun and the Java community and transmuted into other file formats.
tar - tape archive
jar - java archive
war - web application archive
ear - enterprise archive
sar - service archive
The original tar or tape archive files are / were used for software distribution and backups. The format they use is that the file is written as a series of units:
• file name
• file length
• file data
which means that the whole archive file has potentially to be scanned when an element is to be extracted. Furthermore, a tar file in its native form is NOT compressed in any way. This means that a tar file can be both big and inconvenient.
Jar or Java Archive files may also be used for software distribution and backups, and although the jat utility that's used to create and (usually) to unpack them is written in Java and most people use them to contain Java - related information, they can actually contain any file and directory structure. There IS a header (an index or MANIFEST) at the top of a jar file saying what's in the file and where it is, so things can be accessed quickly on a random access systems such as a disc drive, and the data is usually stored compressed (turn compression off with the 0 option when you create a jar). This means that a .jar file is an appropriate medium for extracting information on the fly within a live application, even one that's quite heavily used.
Other file types that I mentioned at the start, such as war and ear are also jar files, created with the jar utility. In fact, they're a subtype of jar files with the data they contain being in a specific file and directory stucture. In other words, the arrangment of files within a war is such that the file and its contents are suitable for deployment as a webapp under a container such as Apache Tomcat, and the arrangement of files within a ear is such that it's an Enterprise Archive such as you would use under JBoss, etc.