JAR (Java Archive) Isn’t Just for Old School Mobile Games
Built on the ZIP file format, a JAR file typically has a .jar file extension. Many of you probably remember these files from back in the day when games like Midnight Pool, Raging Thunder, or Line Rider reigned supreme on mobile phones. In this article, we dive deep into the technical aspects of the JAR file format as well as different ways how to open JAR files and recover them.
What is a JAR File?
JAR files are associated with Java, a general-purpose computer programming language specifically designed to have as few implementation dependencies as possible. This, along with several other important features, made it highly suitable for early mobile and web development. When developers create a new mobile or web app which included audio and image files as well as class files, they needed a way how to distribute it easily. The JAR file format was created to do just that.
Instead of starting from scratch, JAR was based on ZIP, an archive file format that supports lossless data compression. As such, JAR inherited many features from ZIP and added several new ones. Developers were quick to embrace JAR as the go-to method how to aggregate many project files into one file which could be further compressed to save bandwidth.
Most JAR files contain a manifest file, which describes how to use the JAR file and specifies other JAR files to load with the JAR. Furthermore, it’s possible to digitally sign JAR files for extra security. In case user’s Java runtime encounters a signed JAR file, it will refuse to load any classes that don’t match the signature that the JAR file.
These days, the JAR file format is still widely used to distribute software written in Java across multiple platforms. For example, before they were acquired by Microsoft, Mojang used a single downloadable JAR installer to distribute Minecraft. The Linux version of the game is still distributed this way to this day.
How to Open JAR Files?
To open any JAR file, you’ll need to install Java on your system. Two most popular implementations of Java are from Oracle and Open JDK. Because applications have been written with one or the other in mind, you should always use the version recommended by the developers of the program you’re trying to run. For example, the developers of Freenet recommend using Java from Oracle for best performance.
With Java installed on your system, you should be able to run any JAR program by typing “java -jar foo.jar” into the command line (replace the “foo” with the name of the program you want to run). If you don’t want to run the JAR file, you can view individual files within it using a file archiver such as 7-Zip or WinRAR.
How to Recover Deleted JAR Files?
Imagine the following situation: you’ve been developing a multi-platform software in Java for what seems like ages, and you’re finally ready to ship it. You pack everything into a neat JAR file that’s ready for distribution when the worst happens — your hard drive crashes. You quickly boot from another hard drive to see how bad it is, only to discover that all JAR files are gone.
If you hadn’t known any better, you would have probably taken the hard drive to a specialized data recovery place, where they would charge you thousands of dollars. Fortunately, you do know better, and you immediately open your web browser and download the latest version of Disk Drill. With it, you restore all lost files in a very short time for free.