How to run a Java JAR file on Windows 10 |Video upload date:  · Duration: PT2M29S  · Language: EN

Quick guide to run a Java JAR file on Windows 10 using command prompt or double click with clear commands and common fixes

Quick sanity checks before you run anything

If you have a JAR file and you want it to behave like a grown up program on Windows 10 you need to be sure Java is actually available and that the JAR knows how to start itself. This guide shows how to run a JAR from the command prompt using java -jar how double click behavior works and how to associate JAR files with the Java runtime so double click stops being a mystery.

Check Java is installed

Open a command prompt and run the command

java -version

If you see a version number you are golden. If the command is not found download a JDK or a reputable OpenJDK build and install it. Make sure you install a bitness that matches the JAR and any native libraries you plan to use.

Open a command prompt in the JAR folder

Navigate to the folder that contains the JAR in File Explorer. Then type cmd in the address bar and press Enter to open a command prompt right there. On newer Windows versions you may see an option called Open PowerShell window here or Open in Windows Terminal. Any of those work for running Java commands.

Run the JAR with java -jar

Use the standard command to launch an executable JAR

java -jar myapp.jar

Replace myapp.jar with the actual file name. If the app prints things to the console run it this way. If it needs command line arguments just add them after the JAR name for example

java -jar myapp.jar arg1 arg2

What if nothing happens or you get an error about a main class

  • If you see an error saying there is no main manifest attribute the JAR does not have a Main Class declared in its manifest.
  • Look inside the JAR to confirm by running
jar tf myapp.jar

Open the META-INF backslash MANIFEST.MF entry and check for a Main-Class attribute. If there is none you either need a different JAR a wrapper or to run a class from the JAR with a classpath instead.

Double click behavior and javaw

GUI apps sometimes use javaw to avoid leaving a command window open. If double clicking the JAR does nothing the app might require a console or it might need arguments. You can try launching with javaw to see if a GUI shows up

"path to javaw.exe" -jar myapp.jar

To make double click predictable associate the JAR extension with the Java runtime. Right click the JAR file then choose Open with then Choose another app then Browse to the Java bin folder and select javaw.exe and set Always use this app when prompted. If you need to point to the JVM you can look in the Program Files folder on your system drive and then the Java folder backslash bin subfolder to find javaw.exe.

Troubleshooting checklist

  • java is not recognized. Add Java to your PATH or use the full path to java.exe.
  • Main-Class not found. Inspect the manifest and ensure the JAR is executable or run a specific class with the classpath option.
  • Wrong Java version. Some apps need a specific Java major version. Install a matching JRE or JDK.
  • Permissions. Windows may block downloads. Right click the file and check properties if you see an unblock option.
  • Native libraries. If the app depends on native code you may need the correct architecture and supporting files.

Short recap

Run java -version to confirm Java is available. Open a command prompt in the JAR folder and run java -jar myapp.jar. If double click does not work try javaw or associate the JAR with javaw.exe for GUI apps. If the manifest lacks a Main-Class inspect the JAR with jar tf and get a proper executable JAR or run the application with an explicit classpath. That covers most situations so you can stop blaming Windows and start blaming your dependencies instead.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.