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.
What opens 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.
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
Open a .jar file step by step
- Confirm the file really is a .jar. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with Java Runtime (java -jar) or 7-Zip (to inspect).
- On Mac, use Java Runtime (java -jar) or The Unarchiver.
- On Linux, try Java Runtime (java -jar) or unzip.
- Still stuck? Convert the .jar to zip, which opens more widely.
Why can't I open my .jar file?
Almost always because no installed app understands JAR. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .jar at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
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.
What is the .jar file signature (magic bytes)?
A .jar file starts with the hex bytes 50 4B 03 04, which read as PK.. in ASCII. Programs identify JAR by those bytes, not by the filename, so a renamed file still gives itself away.
These are the documented signatures for JAR. For a full breakdown, see the ZIP file signature page.
| Hex signature | Offset | ASCII | Note |
|---|---|---|---|
| 50 4B 03 04 | 0 | PK.. | 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. How sources are ranked and what is deliberately left out is set out in the methodology.