Before going into JAR Java details, let us observe the drawbacks of zip file. You create zip file on Windows platform and the question is can you unzip on a different platform like Linux. No, not possible. Zipping algorithms are platform-dependent. That is, the zip file (.zip extension) you created on Windows should be unzipped on Windows only. Similarly, pkzip is the command to create zip file on DOS platform.
Explanation on JAR Java
When Java came into existence, Java standardized many things in the world like classification of database drivers, messaging services etc. Similarly zipping also. JAR stands for Java ARchive. JAR is zipping style of Java. A JAR file created by Java can be unzipped on any platform where Java is working. Java is a platform-independent language and gives a platform-independent way zipping. With this introduction let us crate a JAR file and later unzip (extraction) it.
The extension of JAR Java file should be .jar and command to create JAR file is jar itself executed from DOS prompt.
Imagine there are ss.png, abc.txt and Ostrich.java files that are needed zipping. Let us zip them.
Observe the DOS prompt. jar is the command to create a JAR file. cvf are options of jar command. c stands for create a jar file, v stands for verbose and f stands for JAR file name is included. The JAR file name is Demo.jar. Verbose means display the zipping information of files like size of files before zipping and after zipping.
The above jar command creates Demo.jar file. See the next Screenshot.
JAR Java: Now let us extract the files from Demo.jar.
The JAR options are t standing for table of contents and f standing for JAR file name is included.
For more explanation, more options of JAR and more operations on JAR like knowing the files existing in the jar file, adding one more file to the existing etc. refer JAR (Java ARchive) Files of this same Web site.