When it comes to saving a file, the number one rule is to give it a clear name that lets users know what it contains without them having to open it. A file ending is often automatically assigned depending on the file format. The different endings are useful because they tell users and their systems whether a file is an image, audio or video file, and which programs are suitable to open it. Besides common examples like .jpg, .mp3 or .png, there are a wide range of other file endings. The .jar format is a less familiar file type, and simply double-clicking on this file type will neither open nor run it.
What are .jar files?
The .jar ending concerns two file types related to the programming language Java. For instance, a .jar file can be a Java application – i.e. a launchable program. If you want to run a .jar file skip ahead to the section “Running a .jar File”.
In most cases, however, a .jar file contains a library of multiple files. The file ending .jar is the abbreviation for “Java archive”. These archives usually contain multiple Java files and metadata that can be sent compiled and compressed. In addition to .jar files, they may also contain images, audio files and other file formats. Therefore, it works like a .zip file.
These libraries are typically used to simplify the programming of Java applications and applets. The archive of meta information, XML or JSON files, images and sound files can be integrated as a fixed component into other projects. An important part of such Java libraries is the manifest: This file contains details about the version and the author of the code. If the archive concerns an executable file, additional information will be available.
Oracle launched the platform-independent and object-oriented programming language Java back in the 1990s. The language is considered to be an imperative programming languages because of its clear command structure.
Opening a .jar File: how it works
To gain access to the individual files in a Java archive, you need to unpack the library. This can be done in a similar way to .zip files. The following compression programs support the .jar file format when unpacking:
- WinRAR: One of the most popular free tools for unpacking compressed files.
- WinZip: The standard version is available with a range of options at a low price.
- 7-Zip: Offers its own efficient file form .7z for archiving.
- UltimateZip: A free alternative for Windows users.
- WinAce: A paid program with an integrity check.
- IZArc2Go: Starts without installing external data media.
- HaoZip: Supports 50 file formats.
If you have a program, unpack the .jar file. You have two ways to do so:
Open the .jar file in the compression program
Open the installed compression program. Then, select the .jar file via the file path or drag it directly into the program. Select the “Unpack” option and follow the program’s instructions.
Select the compression program in the context menu
Right-click on the .jar file. Next, select the option “Open with” from the context menu, followed by the corresponding compression program.
Once the process has finished and the archive is unpacked, open the file with a double-click. Once opened, you should be able to see a list of all the files it contains. The file format is easily recognisable by the file endings, and indicates whether you can open the files. Common formats can be opened by double-clicking on them. To select a different program to run a file, launch the context menu by right-clicking on the file. Then, select the option “Open with” using the left mouse button and choose the relevant program.
Running a .jar file
If the Java archive contains executable .jar files or if the file itself is executable, you will need to use a special program. The most common program Java Runtime Environment (JRE) is available to download for free for Windows and macOS operating systems from the Java website. After installing the program, run the .jar file by double-clicking on it. JRE is a runtime environment that runs files independent from the operating system, thanks to a virtual machine – the Java Virtual Machine (JVM).
If you wish to develop Java applications yourself (and create your own .jar files), you will need to use the Java Development Kit (JDK). OpenJDK is a free open-source software program that is available to download for free.