What is a .jar file?
Java Archive · Archive · Sun Microsystems · 1996
A .jar file is a Java Archive: a ZIP package that bundles compiled Java classes, resources and a manifest into one distributable file. It is how Java libraries and applications are shipped and run.
What is a .jar file used for?
A JAR is a ZIP with a defined layout, so it starts with the ZIP signature 50 4B 03 04. Inside are .class files, resources and a META-INF/MANIFEST.MF that can name a main class, letting the JAR run with java -jar.
Rename a .jar to .zip and you can browse its contents. Running a JAR executes code, so treat unknown ones as you would any program.
How to open a .jar file
The .jar format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .jar file.
Windows
- Java Runtime (java -jar)
- 7-Zip (to inspect)
- IntelliJ IDEA
macOS
- Java Runtime (java -jar)
- The Unarchiver
- IntelliJ IDEA
Linux
- Java Runtime (java -jar)
- unzip
- jar tool
How to convert a .jar file
You can convert a .jar file to zip using a conversion tool or the export menu of an app that opens it.
.jar file signature (magic bytes)
Programs recognise a .jar file by the bytes at the start of the file, not by its name. These are the signatures for JAR. For a full breakdown, see the JAR file signature page.
| Hex signature | Offset | Note |
|---|---|---|
| 50 4B 03 04 | 0 | ZIP package (PK..) |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .jar file?
A .jar file is a Java Archive: a ZIP package that bundles compiled Java classes, resources and a manifest into one distributable file. It is how Java libraries and applications are shipped and run.
How do I open a JAR file?
To run it, use java -jar file.jar with Java installed. To look inside, rename it to .zip or open it in 7-Zip; it is a ZIP archive.
Why won't my JAR file run?
Usually Java is not installed, or the JAR has no main class in its manifest (it is a library, not an app). Install a Java runtime and check the JAR is executable.
Is a JAR file a ZIP file?
Yes. A JAR is a ZIP with a Java layout and a manifest, so it shares the ZIP signature and opens in any archive tool.
Related formats
Sources
Details on this page were checked against authoritative references: