# What JAR Files Are and How to Use Them

A plain guide to JAR files: what a Java archive holds, how an executable JAR runs, what opens one, and how WAR files differ from JAR files.

A JAR file is a Java archive, a single package that holds compiled Java code and the support files a program needs. This page explains what JAR files do, how an executable JAR gets run, and which programs open a .jar file that is not built to launch. 

## What a Java archive holds 

A JAR file packs many files into one container, much as a zip archive does. Inside sit compiled .class files, images, configuration text, and a manifest that lists details about the contents. The Java runtime reads that package as one unit instead of loading loose files from a folder. 

## How an executable JAR runs 

An executable JAR carries a manifest entry naming the class that holds its starting point. A Java runtime reads that entry and launches the program when the file is started, so the archive behaves like an application. The runtime must be installed on the machine, and the correct version matters for the code inside. 

## What opens a .jar file 

The Java runtime opens a .jar file, while a plain archive tool can unpack one to show its contents. A file association decides which program handles the double click, so a .jar may open in an archiver instead of launching. A JAR that unpacks rather than starts is likely not an executable JAR. 

## Questions about JAR files 

### What are executable JAR files? 

Executable JAR files are Java archives built to start a program rather than only store files. Their manifest names a main class, which the Java runtime uses as the entry point. Running one requires an installed Java runtime of a suitable version. 

### What are JAR and WAR files? 

JAR and WAR files are both Java archives, but they serve different jobs. A JAR holds code and resources for a Java application or library. A WAR file packages a web application for a server to deploy, with pages and server settings alongside the code. 

### What do JAR files do? 

JAR files bundle Java code and its resources into one file for storage, sharing, and running. The archive keeps a program together and lets the Java runtime read the manifest. Some JARs act as libraries that other programs load rather than run alone. 

### What should .jar files open with? 

A .jar file should open with the Java runtime when the archive is executable. An archive tool is the fitting choice when you only want to inspect or extract the contents. Check the file association to control which program handles the double click.
