When you have so any classes for your java program then it is good practice to create jar file. A jar files allows developer to efficientl deploy a set of classes and their associated resources.
What JAR file can do?
When developer uses various media files, class files for his java program then JAR files canbe used to bundle all the resources of the program into one JAR file. JAR file can be used to place into one jar file. Jar file makes it easy for application to install & distribute java software. As the elements in a jar file are compressed which makes it easy to download JAR faster than uncompressed file. Developer can use digital certificates/signatures in a program.
Which package used to create JAR?
Package java.uti.Zip* contains the classes that read and write jar files.
What are manifest files?
Manifest files index he file listing in a jar file. In shor, manifest file indicate which are components in a jar file. It may reference several .class files.
So let’s start with creating and manipulating jar files, step by step.
A utility to generate a jar file is “jar”.
jar options files
1) Creating a jar file:
jar cf demo.jar *class *.jpg
2) Listing the contents of jar file:
jar tf demo.jar
3) Extracting files from a jar file:-
jar xf demo.jar
4) Updating an existing jar file:-
jar -uf demo.jar filename.class
Hope the infotmation above helped. If you’ve any questions regarding jar files then feel free to ask it in the comments below.