jar
Java archive creation and extraction tool
TLDR
Create JAR file
SYNOPSIS
jar [options] [manifest] destination input-files
DESCRIPTION
jar is the Java Archive tool. It packages Java class files, resources, and metadata into a single JAR file for distribution and deployment.
JAR files use ZIP format with a manifest (META-INF/MANIFEST.MF) containing metadata. Executable JARs specify a main class in the manifest.
PARAMETERS
c
Create new archive.x
Extract archive.t
List table of contents.u
Update existing archive.f file
Specify archive filename.m manifest
Include manifest file.e class
Set entry point (main class).v
Verbose output.0
Store only (no compression).C dir
Change to directory.
MANIFEST EXAMPLE
Main-Class: com.example.Main
Class-Path: lib/dependency.jar
CAVEATS
Order of flags matters. Manifest file needs newline at end. Paths are relative to current directory. Use -C for changing base directory.
HISTORY
The jar tool has been part of the JDK since Java 1.1 (1997). It's essential for Java deployment, evolving to support modules in Java 9+ and multi-release JARs.
