What Is a JAR File?

How to Open, Edit, and Convert JAR Files

JAR Files
JAR Files.

A file with the .JAR file extension is a Java Archive file used for storing Java programs and games in a single file. Some contain files that make them work as standalone apps and others hold program libraries for other programs to use.

JAR files are ZIP compressed and often store things like CLASS files, a manifest file and application resources like images, sound clips and security certificates. Since they can hold hundreds or even thousands of files in a compressed format, it's easy to share and move JAR files.

Java-capable mobile devices might use JAR files as game files, and some web browsers hold themes and add-ons in the JAR format.

How to Open JAR Files

The Java Runtime Environment (JRE) must be installed in order to open executable JAR files, but note that not all JAR files are executables. Once installed, you can just double-click the JAR file to open it.

Some mobile devices have JRE built-in. Once installed, Java applications can be opened in a web browser too, like Firefox, Safari or Internet Explorer (but not Chrome).

Since JAR files are compressed with ZIP, any file decompressor can open one to see the contents that are inside. This includes programs like 7-Zip, PeaZip and jZip

Another way to open JAR files is to use the following command in Command Prompt, replacing yourfile.jar with the name of your own JAR file:

java -jar yourfile.jar

Since you might need different programs to open different JAR files, see How to Change the Default Program for a Specific File Extension in Windows if it's automatically opening in a program that you don't want to use it with.

Errors Opening JAR Files

Because of security settings in the Windows operating system and within some web browsers, it's not at all uncommon to see errors when attempting to access Java applications.

For example, "Java Application Blocked" might be seen when trying to load a Java applet. "Your security settings have blocked an untrusted application from running.

" can be fixed by setting the security level within the Java Control Panel applet.

If you can't open Java applets even after installing JRE, first make sure Java is enabled in your browser and that Control Panel is properly set up to use Java. Then, completely restart your browser by closing down all open windows and then reopening the whole program.

Also, check that you're running the latest version of Java. If you're not, return to that JRE link above and install the latest version.

How to Convert a JAR File

You can decompile a JAR file's CLASS files to Java files with the help of the JavaDecompilers.com website. Upload your JAR file there and choose which decompiler to use.

See this blog post on converting Java to EXE if you're interested in making an EXE file from the JAR application.

Converting a Java application so that it can be used on the Android platform would require a JAR to APK file conversion. One option might be to run the JAR file in an Android emulator so that the program creates an APK file automatically. However, it seems that the easiest way to get a Java program on Android is to simply compile the APK from the original source code.

You can make executable JAR files in programming applications like Eclipse.

WAR files are Java Web Archive files, but you can't convert a JAR file directly to a WAR file since the WAR format has a particular structure that JARs do not. Instead, you can build a WAR and then add the JAR file into the lib directory so that the classes inside the JAR file are available for use. WizToWar might help you do this.

To make a ZIP file from a JAR file is as easy as renaming the file extension from .JAR to .ZIP. This doesn't actually perform a file conversion but it does let programs that use ZIP files, like 7-Zip or PeaZip, more easily open the JAR file.

More Information on the JAR Format

If you need help packing programs into JAR files, follow that link for instructions on the Oracle website.

Only one manifest file can be included in a JAR archive and it has to be at the META-INF/MANIFEST.MF location. It should follow the syntax of the name and value separated by a colon, like Manifest-Version: 1.0. This MF file can specify the classes that the application should load.

Java developers can digitally sign their applications but it does not sign the JAR file itself. Instead, the files inside the archive are listed with their signed checksums.