"Jar" - what is it, definition of the term
A sealed cylindrical container, usually fashioned from glass or clear plastic, serves to hold substances or small organisms; in laboratory practice it provides a controlled environment for rodents such as rats and mice, offering visibility, easy cleaning, and the capacity to maintain consistent temperature and humidity.
Detailed information
The Java archive file is a container format that bundles compiled classes, associated metadata, and resource files into a single compressed package. It adheres to the ZIP compression algorithm, enabling efficient storage and distribution of Java applications and libraries.
The archive’s internal structure consists of three essential elements:
- Compressed entries – individual class files, images, configuration files, and other resources stored using ZIP compression.
- Manifest file – a plain‑text descriptor located at
META-INF/MANIFEST.MF
that defines package attributes such as version, entry point, and classpath extensions. - Signature files – optional security records placed in
META-INF/
that verify the integrity and authenticity of the package contents.
Creation of an archive is performed with the jar
command‑line tool provided by the Java Development Kit. Typical usage includes specifying the manifest, adding files, and optionally compressing entries. Example syntax:
jar cfm MyApp.jar Manifest.txt -C classes/ .
Execution of a self‑contained archive requires the presence of a Main-Class
attribute in the manifest. When invoked with the Java runtime, the container launches the designated entry point without extracting its contents to the filesystem:
java -jar MyApp.jar
Security considerations revolve around the manifest and signature files. The manifest can declare trusted libraries, while digital signatures protect against tampering. Validation occurs during runtime; any mismatch triggers a security exception, preventing execution of compromised code.
Versioning is managed through manifest attributes such as Implementation-Version
and Specification-Version
. These fields enable developers to track releases, enforce compatibility checks, and automate update processes.
The format is widely adopted for distributing reusable libraries, modular components, and complete applications across diverse platforms, ensuring consistent behavior and simplified deployment.