Jan K. Labanowski: "Tomcat, servlets, JSPs and other friends"

Java jar utility

Java is an object oriented language which places emphasis on code reuse. It is typical to reuse code previously developed and make it available within current project. Even Standard edition consists of about 3000 classes providing basic functionality and practices. Managing this Zoo as individual classes would be cumbersome. You can reuse the classes previously developed either by:

  • listing directories which contain classes in the CLASSPATH.
  • incorporating classes in the jar file, and adding jar to the CLASSPATH.
The jar file stands for Java ARchive. The utility to process these files is called jar. It uses similar syntax as popular UNIX tar utility. Format of the jar is that of zip file rather than tar file, and these files can be created/unpacked also with the popular zip/unzip utility, i.e.:
    unzip some.jar
and
    jar xvf some.jar
do the same thing: unpack the archive.