Java Archive File (JAR)

Zip files and Jar Files Java Archive (JAR) files provide a compact way to store a number of classes or other data resources.
  The format of a jar file is similar to a zip file.
java.util.zip

java.util.jar

Classes in java.util.zip and java.util.jar packages provide methods for reading writing data with steam methods that compress and decompress files.
  The JAR file format add a manifest file to the zip format. This file gives extra information about each of the data items in the file.
  Extra information may include digital signatures to positively identify applications as coming from a know source.
   
  Connection over a network is time consuming. Loading large classes across the network is slow.
JAR A JAR file can be used to package an application classes and resources in a compressed file to be sent across the network.
  The JAR file can contain class files, images, sounds, applet, etc..
  JAR files can be used for application distribution. Specially Java beans.
   
Creating JAR files The jar command can be used to create jar files. The options most likely used are:
  c Create a new archive
  x extract file from the archive
  f specify the archive’s file name
  O Don’t use zip to compress the file. This allows the placing of the JAR files in a directory in the current path.
  v view the archive table contents.
   
  Creating a jar file:
  jar –cf Jungle.jar Panther.class Leopard.class
   
Using a JAR in an Applet <applet code=ExampleApplet.class

archive=”jars/example.jar”

width=255 height=110

</applet>

archive tag The archive keyword is used to specify the JAR file to be used when the applect needs a class and other resources.
  The applet looks in the JAR file first, then on the server.
   
  More than one JAR file can be define in the archive parameter.