What a JAR file is and why you need the right tool
A JAR file is a compressed archive that contains Java code and runs on your computer like any other program. JAR stands for Java Archive. To run one, you need Java installed — specifically the Java Runtime Environment, or JRE. Without it, double-clicking the file does nothing.
The confusion happens because JAR files look like regular files in your folder, but they are not executable on their own the way a .exe file is on Windows or an .app file is on Mac. Your computer needs Java to translate the code inside the JAR into something it can actually run.
This guide walks you through checking whether you have Java, installing it if you do not, and then running the JAR file itself. The steps differ slightly between Windows, Mac, and Linux, so find your operating system below.
Key Takeaways
- JAR files require Java Runtime Environment (JRE) to run; without it installed, the file will not open.
- You can check whether Java is installed by opening Command Prompt (Windows), Terminal (Mac), or a terminal window (Linux) and typing java -version.
- If Java is not installed, download it from oracle.com or adoptopenjdk.net, then install it following the on-screen prompts.
- Once Java is installed, you can run a JAR file either by double-clicking it or by typing a command in your terminal window.
- If double-clicking does not work, the command java -jar filename.jar (typed in the same folder as the file) will almost always run it.
Check whether Java is already installed
Before you download anything, find out whether Java is already on your computer. Open Command Prompt on Windows (search for "cmd" in the Start menu), Terminal on Mac (find it in Applications > Utilities), or a terminal window on Linux. Type this exactly:
java -version
Press Enter. If you see a version number — something like "java version 11.0.15" — Java is installed and you can skip to the section on running the JAR file. If you see "command not found" or "java is not recognized", Java is not installed and you need to download it.
Download and install Java on Windows
Go to oracle.com/java/technologies/downloads. Click the large button labeled "x64 Installer" under Windows. This downloads a file named something like jdk-21_windows-x64_bin.exe. Open it and follow the on-screen prompts. Accept the license agreement, choose the default installation folder, and click Install. When it finishes, restart your computer.
After restart, open Command Prompt again and type java -version to confirm the installation worked. You should see a version number this time.
If you prefer not to use Oracle's installer, adoptopenjdk.net offers an alternative. The steps are the same: download the Windows installer, run it, accept defaults, and restart.
Download and install Java on Mac
Go to oracle.com/java/technologies/downloads and click the button labeled "Arm 64 Installer" if you have an Apple Silicon Mac (M1, M2, M3), or "x64 Installer" if you have an Intel Mac. This downloads a .dmg file. Open it and follow the on-screen prompts. When installation finishes, restart your computer.
Open Terminal (Applications > Utilities > Terminal) and type java -version to confirm. You should see a version number.
Adoptopenjdk.net also offers Mac installers if you prefer. The process is identical.
Download and install Java on Linux
Most Linux distributions include a package manager that handles Java installation. Open a terminal and type one of these commands, depending on your distribution:
Ubuntu or Debian: sudo apt install default-jre
Fedora, CentOS, or RHEL: sudo yum install java-latest-openjdk
Type your password when prompted. The package manager downloads and installs Java automatically. When it finishes, type java -version to confirm.
If you prefer to download the installer manually instead, go to adoptopenjdk.net, download the Linux version, and follow the on-screen instructions.
Run the JAR file by double-clicking
Once Java is installed, the simplest way to run a JAR file is to double-click it. Navigate to the folder where the JAR file sits, find it in the list, and double-click. A window should open and the program should start.
On Windows, if double-clicking opens a compressed archive window instead of running the program, right-click the JAR file, choose "Open with", and select Java. If Java does not appear in the list, choose "Choose another app", scroll down, and look for "Java Platform SE Binary" or similar.
On Mac, double-clicking usually works without extra steps. If it does not, right-click the file, choose "Open With", and select Java.
Run the JAR file from the command line
If double-clicking does not work, or if you prefer using the terminal, you can run the JAR file with a command. Open Command Prompt (Windows), Terminal (Mac), or a terminal window (Linux). Navigate to the folder where the JAR file is located. Type this command, replacing filename with the actual name of your JAR file:
java -jar filename.jar
Press Enter. The program should start. If you see an error message, the most common causes are that Java is not installed (go back and check java -version), the filename is spelled wrong, or you are in the wrong folder. Type dir (Windows) or ls (Mac and Linux) to see what files are in your current folder and verify the JAR file name.
If the JAR file requires more memory than Java allocates by default, you can increase it. Type this instead, replacing 2048 with the number of megabytes you want to allow:
java -Xmx2048m -jar filename.jar
Frequently Asked Questions
What if I double-click the JAR file and nothing happens?
Java is probably not installed or not set as the default program for JAR files. Open Command Prompt or Terminal and type java -version. If you see a version number, Java is installed — right-click the JAR file, choose "Open With", and select Java. If you see "command not found", install Java using the steps above.
Can I run a JAR file without installing Java?
No. JAR files are Java programs and require the Java Runtime Environment to run. There is no way around this. You must download and install Java first.
Why does my JAR file say "out of memory" when I try to run it?
The program needs more RAM than Java is allowing it by default. Use the command java -Xmx4096m -jar filename.jar to give it 4 gigabytes (adjust the number as needed). If you do not know how much to allow, try 2048 first and increase it if the error continues.
Is it safe to download Java from oracle.com?
Yes. Oracle is the company that develops Java. Adoptopenjdk.net is also safe and offers an alternative. Do not download Java from any other website.
Do I need the JDK or just the JRE?
You need only the JRE (Java Runtime Environment) to run JAR files. The JDK (Java Development Kit) is for people who write Java code. When you download from oracle.com or adoptopenjdk.net, look for the option labeled "JRE" or "Runtime".