How to Run a JAR File on Windows 10 and 11

A .jar (Java Archive) file is a packaged Java program. Windows 10 and Windows 11 can’t run it on their own: you need Java installed first. Once Java is set up, you can open an executable JAR by double-clicking it or by running java -jar in Command Prompt. This guide shows how to install Java, run JAR files both ways, fix double-click associations, and solve common errors like “no main manifest attribute.”

Quick Answer

Install a current Java runtime or JDK (for example Java 21 or 25 LTS), then open Command Prompt, go to the folder with the file, and run java -jar filename.jar. Or right-click the JAR and choose Open with > Java(TM) Platform SE binary (or your Java version).

Command prompt showing the installed runtime version check and a command that runs a JAR file from the Downloads folder
Check your Java version, then run the file with java -jar.

Step 1: Check Whether Java Is Installed

  1. Press Windows + R, type cmd and press Enter.
  2. Type java -version and press Enter.
  3. If you see a version number, Java is installed. If you see “‘java’ is not recognized,” install it in Step 2.

Some programs require a specific Java version. Check the program’s website or readme.

Step 2: Install Java

  1. Download a Java build for Windows x64 (or Arm64 on Arm PCs). Popular free options include Eclipse Temurin from Adoptium, the Microsoft Build of OpenJDK, and Oracle JDK (check Oracle’s license terms for your use).
  2. Choose the .msi installer and a long-term support (LTS) version such as 21 or 25, unless your program needs another version.
  3. Run the installer. If offered, enable Set JAVA_HOME, Add to PATH and JAR file association.
  4. Open a new Command Prompt and run java -version to confirm.

You can also install Java from the command line: winget install EclipseAdoptium.Temurin.21.JDK.

Step 3a: Run the JAR by Double-Clicking

  1. Open the folder with the JAR file in File Explorer.
  2. Double-click the file. If it opens in a ZIP tool or asks which app to use, right-click it > Open with > Choose another app.
  3. Pick Java(TM) Platform SE binary or OpenJDK Platform binary. If it’s not listed, click More apps > Look for another app on this PC and browse to javaw.exe in the Java install’s bin folder (for example C:\Program Files\Eclipse Adoptium\jdk-21…\bin).
  4. Check Always use this app and click OK.

Double-clicking uses javaw.exe, which doesn’t show a console window. Command-line tools that print text should be run from Command Prompt instead.

Step 3b: Run the JAR From Command Prompt

  1. Open Command Prompt.
  2. Go to the folder: cd %USERPROFILE%\Downloads (or wherever the file is). Tip: type cd and drag the folder into the window.
  3. Run java -jar filename.jar. Put the name in quotes if it contains spaces.
  4. Add options if needed, such as more memory: java -Xmx2G -jar filename.jar.

In File Explorer, you can type cmd in the address bar and press Enter to open Command Prompt in the current folder.

Create a Shortcut or Batch File

Create a text file named run.bat in the same folder containing:

@echo off
java -jar "filename.jar"
pause

Double-click run.bat to launch the program and keep the window open to see any messages.

Troubleshooting

  • “no main manifest attribute”: the JAR is a library, not a runnable program, or needs a specific main class. Check the program’s instructions; some use java -cp filename.jar com.example.Main.
  • “UnsupportedClassVersionError”: the program needs a newer Java version. Install it and try again.
  • Nothing happens on double-click: run it from Command Prompt to see the error message.
  • Opens in a ZIP program: fix the association as in Step 3a. Free tools such as Jarfix can also repair .jar associations.
  • Windows SmartScreen or antivirus warning: only run JAR files from trusted sources. A JAR can do anything a regular program can.
  • Multiple Java versions: run the one you need by its full path, for example “C:\Program Files\Java\jdk-25\bin\java.exe” -jar filename.jar.

Frequently Asked Questions

Do I need the JDK or just a JRE?

To run programs, a runtime is enough, but many modern Java distributions only offer the full JDK, which works fine.

Can I open a JAR to see what’s inside?

Yes. A JAR is a ZIP file. Open it with 7-Zip or rename a copy to .zip to browse its contents.

How do I run Minecraft server JARs?

The same way: java -Xmx4G -jar server.jar nogui, using the Java version the server requires.

Summary

  1. Check Java with java -version.
  2. Install a current Java build if needed.
  3. Double-click the JAR or run java -jar filename.jar.
  4. Fix file associations or version errors as needed.