A JAR file is a bundling and deploying utility that executes upon Java programs. The JAR tool is used to create a JAR file. The file contains class files, image files, and audio/video files. It also contains a manifest file, which contains information such as whether the class file is a javabean, or which class contains the main method, etc. The basic syntax of the command for creating a JAR file is as follows:
jar -cf jar-file input-file(s)
where,
c indicates a JAR file is going to be created.
f indicates the output of the command execution will go to a file rather than to stdout.
jar-file is the name of the resulting JAR file.
input-file(s) specify a space-separated list of one or more files that are going to be included in the JAR file. It can use the wildcard * symbol.
After using this command, it will generate a compressed JAR file and place it in the current directory. It also generates a default manifest file for the JAR archive.
[...] 19 While using a JAR file when a directory is specified in the classpath, the files are searched in the directory [...]