📖 What is a JAR File?
A JAR file is a Java package that bundles many files into one. The name stands for Java ARchive, and the file uses the .jar extension. It gathers a Java program's compiled code and resources into a single compressed file that is easy to share and run.
Under the surface, a JAR is really a ZIP file. It uses the same compression, so any tool that opens a ZIP can open a JAR. What makes it a JAR rather than a plain ZIP is a small amount of Java-specific information inside, above all a manifest that tells Java how to use the file.
The format was built so a whole Java application, its code and its resources, could travel together and download in one go. Today a JAR is either a library of code that other programs use, or a runnable application you can start directly.
Key Characteristics
- A Java package, bundling code and resources
- Built on ZIP, so any archive tool opens it
- Runs with Java, if it is an executable JAR
- Holds a manifest, which tells Java how to run it
Two Kinds of JAR
- Library JAR, support code used by other programs
- Runnable JAR, a standalone app you launch
- Signed JAR, verified with a digital signature
- Only some run, many are not meant to be launched
⚡ Quick Facts
| File Extension | .jar |
| Full Name | Java Archive |
| Category | Java package, archive |
| Based On | ZIP compression |
| Runs With | Java, the JRE or JDK |
| Developed By | Sun Microsystems, now Oracle |
| MIME Type | application/java-archive |
| Manifest | META-INF/MANIFEST.MF |
| Opens or Runs In | Java, 7-Zip, WinRAR, the jar tool |
| Related Extensions | .zip, .war, .ear, .class |
📦 What a JAR File Contains
Open a JAR and you find the parts of a Java program packed together. The pieces fall into a few groups, and one small file quietly runs the show.
Class Files
The compiled Java code, the .class files that the Java runtime actually executes.
Resources
Images, sounds, text and settings the program needs, all bundled alongside the code.
The Manifest
A file at META-INF/MANIFEST.MF that describes the JAR and names the class to run first.
Signature
An optional digital signature that lets Java verify the JAR came from a trusted source.
META-INF/MANIFEST.MF # describes the archive
Main-Class: com.example.App # the entry point that runs first
Class-Path: lib/other.jar # other JARs it needs
▶️ How to Run a JAR File
Running a JAR means launching it as a Java application. For that you need Java installed, and the JAR itself has to be the runnable kind.
Install Java
Get the Java Runtime, the JRE or the full JDK, from the Java download page. This provides the Java Virtual Machine, or JVM, that runs the code. Without Java on the machine, a JAR cannot run at all.
Double-click or command line
If Java is set up, double-click the JAR to launch it. Or open a terminal and type java -jar file.jar, which works on any system.
Let it start
Java reads the manifest, finds the Main-Class and runs it. A runnable JAR then opens like any other program on your screen.
🗂️ How to Open and Extract a JAR
Sometimes you do not want to run a JAR but to look inside it. Because a JAR is a ZIP, this is simple with any archive tool.
Use an archive tool
Open the JAR with 7-Zip, WinRAR or WinZip, the same programs you use for ZIP files, and browse its contents.
Rename to .zip
You can also copy the file and change the ending from .jar to .zip, then open it with the built-in unzip on any system.
Use the jar tool
If you have the JDK, the command jar xf file.jar extracts everything into the current folder from the terminal.
🛠️ If a JAR Will Not Run
Many JAR files are libraries, meaning support code with no starting point, so nothing happens when you open them, and that is expected. A runnable JAR needs a Main-Class listed in its manifest, and it needs Java present to launch.
Check Java is installed
Open a terminal and type java -version. If it is not recognised, install the Java Runtime and try again.
The main class error
If you see "Could not find or load main class", the JAR has no runnable entry point, so it is a library rather than an app.
A very common case on Windows is a JAR that opens in an archive tool like WinRAR instead of running, which means an unzip program has taken over the .jar association. The fix is to point .jar files back at Java, by right-clicking and choosing Java Platform SE Binary, which is the javaw program, or with the free Jarfix tool that repairs the association in one click. This snag turns up a lot with Minecraft mod loaders.
⚔️ JAR vs WAR and EAR
JAR, WAR and EAR are all Java archives built the same ZIP way, but they target different jobs. The difference is what they package and where they run.
| Format | Full Name | Packages | Needs to Run |
|---|---|---|---|
| JAR | Java Archive | Code and libraries | Just Java |
| WAR | Web Archive | A web application | A servlet container |
| EAR | Enterprise Archive | A full enterprise app | A Java EE server |
In short, a JAR is the basic building block that only needs Java, while a WAR bundles a web app for a server like Tomcat, and an EAR packages a large enterprise application for a full application server. WAR and EAR are really specialised JARs with extra structure.
🎯 Where JAR Is Used
The JAR format turns up wherever Java does, from desktop programs to the libraries developers build on.
| Desktop apps | Standalone Java programs shipped as a single runnable JAR you can launch. |
| Libraries | Reusable code that developers add to their own projects, the most common use. |
| Minecraft mods | Minecraft Java Edition uses JAR files for mod loaders like Forge and Fabric, and for the mods themselves. |
| Mobile games | Older Java-enabled feature phones ran games and apps packaged as JAR files. |
| Browser add-ons | Programs like Firefox and Thunderbird have used JAR files for themes and extensions. |
🔀 Related Formats
JAR sits among the archive and Java formats you compare it with.
.zip | The archive format JAR is built on, openable with any compression tool. |
.war | A Web Archive, a JAR that packages a web application for a servlet container. |
.ear | An Enterprise Archive, a JAR for a full application on a Java EE server. |
.class | A single compiled Java file, the kind of code a JAR bundles together. |
.apk | The Android package format, also a ZIP-based archive of an app. |
❓ Frequently Asked Questions
It depends what you want. To run it as an app, install Java, then double-click the JAR or type java -jar file.jar in a terminal. To look inside instead, open the JAR with an archive tool like 7-Zip or WinRAR, since a JAR is a ZIP, and browse or extract its contents. Not every JAR is meant to run, so many only open as archives.
First install Java, either the JRE or the JDK, since a JAR cannot run without it. Then double-click the file if Java is set up to launch JARs, or open a terminal and type java -jar file.jar, which works on Windows, Mac and Linux. Java reads the manifest, finds the entry point and starts the program.
Make sure Java is installed, then double-click the JAR. If it does not launch, right-click it, choose Open With and pick Java Platform SE Binary, which tells Windows to run it with Java. You can also open Command Prompt and type java -jar file.jar. If Windows opens it in an archive tool instead, that association just needs fixing.
Usually one of two reasons. Either Java is not installed, so nothing can run the file, or the JAR is a library with no starting point and was never meant to launch. Check Java with java -version in a terminal, and if you see a could not find or load main class error, the JAR is support code rather than a runnable app.
To run a JAR as an application, yes, you need Java installed. To simply look inside and extract its files, no, because a JAR is a ZIP and any archive tool like 7-Zip or WinRAR opens it. So viewing the contents needs no Java, but launching the program does.
Essentially yes. A JAR uses the same ZIP compression and structure, so any ZIP tool can open one. The difference is that a JAR adds Java-specific contents, above all a manifest file that describes the archive and can name the class to run. You can even rename a .jar to .zip and open it with a normal unzip tool.
Open it with an archive program such as 7-Zip, WinRAR or WinZip and extract the contents like any ZIP. You can also rename the file from .jar to .zip and use your system's built-in unzip. If you have the JDK, the command jar xf file.jar extracts everything into the current folder from a terminal.
Both are ZIP-based Java archives, but they package different things. A JAR holds general code and libraries and needs only Java to run. A WAR, or Web Archive, packages a complete web application and needs a servlet container like Tomcat to run. A WAR is really a specialised JAR with extra web structure inside.
An executable, or runnable, JAR is one you can start directly as a program. It has a Main-Class entry in its manifest that names the class to run first, so Java knows where to begin. A plain library JAR lacks this entry, which is why it does nothing when you double-click it and only serves as support code.
The manifest is a small text file at META-INF/MANIFEST.MF inside the JAR that describes the archive. Its most important line is Main-Class, which names the entry point of a runnable JAR, and it can also list a Class-Path of other JARs the program needs. Java reads the manifest to know how to use or run the file.
Yes. Java runs on macOS, so with Java installed you can run a JAR by double-clicking it or with java -jar file.jar in Terminal. To look inside instead, an archive tool like The Unarchiver opens it, or you can rename it to .zip and use the built-in extractor, since a JAR is a ZIP underneath.
JAR stands for Java ARchive. It is a package format that bundles a Java program's compiled code and resources into one file, built on the ZIP format so it is compressed and easy to share. The name is written in capitals but spoken as the word jar, and the file always uses the .jar extension.
It depends on the JAR. A mod loader like Forge or Fabric comes as a runnable JAR you launch once to install it, so double-click it or use java -jar with Java installed. Individual mods are also JAR files, but you do not run those, you drop them into the mods folder of your Minecraft install. If a loader JAR will not launch, the .jar association usually needs fixing.
Because an archive tool has taken over the .jar file association on Windows. Since a JAR is a ZIP, programs like WinRAR or 7-Zip sometimes claim it, so double-clicking opens the archive rather than running the app. Fix it by right-clicking the JAR, choosing Open With and picking Java Platform SE Binary, or by running the free Jarfix tool, which resets the association in one click.
You can open a JAR and swap out resources like images or text with any archive tool, since it is a ZIP. The compiled .class code inside is not readable directly, but a Java decompiler can turn it back into approximate source to inspect. Editing compiled code is advanced work, and a signed JAR also carries a signature in META-INF that breaks if you change the contents.
📝 Summary
A JAR file is a Java Archive, a package that bundles a Java program's compiled code and resources into one file using the .jar extension. It is built on the ZIP format, so any archive tool opens it, and it carries a manifest that can name the class to run. A runnable JAR launches as an app when you have Java installed, either by double-clicking or with java -jar file.jar, while a library JAR is support code that does not run on its own. To look inside instead, open it with 7-Zip or rename it to .zip. WAR and EAR are specialised JARs for web and enterprise apps that need a server to run.