JAR (.jar) files are archive files that contain Java class and associated metadata and resources. They are built on the ZIP format. They are typically executed within a Java environment, but they can also be opened using archive programs like WinZIP, WinRAR, and 7-Zip. This minHour teaches you how to extract a JAR file's contents.
Using an Archiving App
Install an archive program.
JAR files work just like ZIP files. You can use any archive program to extract them. On Windows, you can Install WinRAR 7-Zip, or WinZIP. Macs have their own built-in archive program called Archive Utility.
Find the JAR file you want to extract.
Use File Explorer (press to open File Explorer) or Finder on Mac to navigate to the JAR file you want to extract.
Right-click the JAR file.
Doing so prompts a drop-down menu.
Select Open with.
It’s in the drop-down menu. A pop-out menu will appear with programs you can use to open the file.
- If you don’t see this option, click the JAR file once, then right-click it again and select Open with.
Click the Archive program you want to use.
You can use any archive program you have available on your computer.
- On Mac, click Archive Utility.
Click Extract files or Extract here.
“Extract files” gives you the option to select a destination to extract the file to. “Extract here” extracts the files to the same location the Jar file is located.
Select an extraction location.
If necessary, click one of the folders on the right side of the window to select it as the location to which you want to extract your JAR file (WinRAR). If you are using 7-Zip, click the icon with three dots in the upper-right corner and navigate to the folder you want to extract the files to. Then click .
Click OK.
It’s at the bottom of the WinRAR window. Doing so will extract your JAR file to the selected folder.
Using Java on Windows
Make sure you have Java SE installed.
If you don’t have Java SE (the Java Developer Kit) installed, you won’t be able to use the “jar” extraction command, and your file will be impossible to extract with this method:
- Open the JDK download page.
- Click the Windows tab.
- Scroll down and click “https://download.oracle.com/java/17/latest/jdk-17_windows-x64_bin.exe” next to “Windows x64 Installer”.
- Click the checkbox next to agree to the license agreement and click the green download button.
- Open the JDK install file and click Yes.
- Click Next.
- Click Close.
Press ⊞ Win+E to open File Explorer.
Click the folder-shaped File Explorer app icon in the taskbar that’s at the bottom of your computer’s screen.
Go to the JAR file’s location.
Find the JAR file that you want to unzip.
Select the JAR file’s path.
Click a blank space in the address bar at the top of the File Explorer window to do so.
Press Ctrl+C to copy the path of the JAR file.
This will save the path to your JAR file.
Open Start.
Click the Windows logo in the bottom-left corner of the screen.
Type in cmd and press ↵ Enter.
This opens the Windows Command Prompt.
Navigate to the JAR file’s path location.
To do this type in cd and press the space bar. Then press to past the file’s path. Then press “Enter”..
Type in jar xf followed by a space followed by the name of the JAR file.
This is the command to extract a JAR file.
- For example, to extract a JAR file called “minecraft”, you would type in jar xf minecraft.jar.
Press ↵ Enter.
This executes the command and extracts the JAR file.
- If you receive an error message that says “‘jar’ is not recognized as an external or internal command”, you need to change the path environment variable to “C:Program FilesJavajdk[latest version]bin” Make sure you replace “[latest version]” with the latest version of Java Development Kit you have installed.
Go back to the JAR file’s location.
You should now see the JAR file’s extracted contents here.
Using Java on a Mac
Make sure you have Java SE installed.
If you don’t have Java SE (the Java Developer Kit) installed, you won’t be able to use the “jar” extraction command, and your file will be impossible to extract with this method:
- Open the JDK download page.
- Click the macOS tab.
- Scroll down and click “https://download.oracle.com/java/17/latest/jdk-17_macos-x64_bin.dmg” next to “macOS Installer”.
- Open the JDK dmg file.
- Double-click the JDK pkg file.
- Click Continue
- Click Install.
- Enter your Mac user password and click Install Software.
- Click Close
Open Finder.
Click the Finder app icon, which resembles a blue face, in your Mac’s Dock.
Find your JAR file.
Go to the location of the JAR file that you want to extract.
Select your JAR file.
Click the JAR file once to do so.
Copy the JAR file’s path.
Use the following steps to copy the path of the JAR file:
- Right-click the JAR file.
- Hold OPTION and click Copy [jar file] as pathname.
Open Spotlight.
Click the magnifying glass-shaped Spotlight icon in the top-right corner of the screen to do so.
Open Terminal.
Type “terminal” into the Spotlight text box, then double-click the Terminal icon when it appears. This will open a Terminal window.
Type in jar xf and press the space bar.
This is the command to extract a JAR file. Don’t press enter just yet, there is still more you need to do.
Press ⌘ Command+V to paste in your JAR file’s path, and press ⏎ Return.
This executes the command to extract the JAR file.
Go back to the JAR file’s location.
You should now see the JAR file’s extracted contents here.
Tips
- Popular versions of Linux, such as Ubuntu, allow you to extract JAR files by using the right-click menu: right-click the JAR file you want to extract, click Extract Here, click Close when prompted, and open the folder that’s named after your JAR file.
- If you’re going to be running and extracting more than a few JAR files, installing Java is recommended.
Warnings
- While changing the .jar extension to a .zip extension on a Mac may sometimes allow you to extract the JAR, this method is more likely to cause an error.