Jar stands for Java Archive. It is a java based compressed file and used for grouping java library files (i.e. class files) for distributing library file as part of software.
Ans: jar command has different options to create and use jar file.
To know more jar options:
If any file is a directory then it is processed recursively.
The manifest file name, the archive file name and the entry point name are specified in the same order as the 'm', 'f' and 'e' flags.
Example 1:to archive two class files into an archive called classes.jar: jar cvf classes.jar Foo.class Bar.class
Example 2:use an existing manifest file 'mymanifest' and archive all the files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .
Open command prompt -> change directory path to present working directory and run following command
jar -cvf javafile.jar abc xyz mbc.txtonly abc, xyz and mbc.txt file are added to jar file from present working directory and jar file is stored in the same present working directory
jar -cvf javafile.jarAll files and folder of the present working directory are added.
jar -cvf test.jar *.txtonly .txt extinction file are added to jar file.
The above jar file is a normal jar file, not an executable jar file.
Example:To create chating.jar file having clients class as main class use following command
jar cvfe chating.jar client clients.class servers.class index.jpg