How to Run .JAR Files on Windows 10

If you find yourself unable to open .jar files on Windows 10, it is likely due to one of the following problems:

*The Java Run-Time Environment is not properly set to run .jar files
*Windows Registry is not calling JRE (Java Runtime Environment) properly

Luckily there are a couple of easy solutions for fixing this. What happens for most people is that when trying to open a .jar file, Windows will typically ask what program you want to use to run the program. Of course, most people would simply choose the Java.exe, but this has the problem of stripping –jar from the program’s execution path. Basically you cannot set the required complex command to open .jar files by using “Open With…” in Windows 10.

So what will normally happen is that you’ll associate the .jar file to open with java.exe, you double-click on the executable .jar, and a command prompt window will open for a split second and close, and the program does not launch.

What we need to do is re-associate the .jar file with the Java binary.

  1. Make sure you are updated with the latest Java Runtime Environment.
  2. Navigate to your Java installation folder, go inside the /bin/ folder, right-click on Java.exe and set it to “Run as Administrator”.
  3. Press Windows + X keys and select “Command Prompt (Admin)” or Powershell (Admin) and type cmd
  4. Type the following commands into the prompt (replace the C:\Program Files\etc with your actual Java installation folder, for example, C:\Program Files (x86)\Java\jre1.8.0_131\bin\java.exe):

ftype jarfileterm=cmd /s /k “”C:\Program Files\Java\jre7\bin\java.exe” -jar “%1″ %*”
assoc .jar=jarfileterm
 

Or if you want the command prompt to stay open after launching the .jar file (for debugging purposes)

ftype jarfileterm=cmd /s /k “”C:\Program Files\Java\jre7\bin\java.exe” -jar “%1″ %*”
assoc .jar=jarfileterm
 

Now try to launch the .jar file. Depending on which of the steps above you took, the java executable should either launch or launch with a persistent command prompt behind it (which will fill up with Java calls from the app, useful for debugging purposes).

However, if the steps did not work, we will need to tweak your registry.

  1. Right-click on your Start button and do a search for “regedit”, then open it.
  2. Now expand the HKEY_CLASSES_ROOT folder, and scroll down until you find the folders “jar_auto_file” and “jarfileterm”.
  3. Expand to the following path
    jar_auto_file > Shell > Open > Command
  4. You will see a key named “Default”. Right-click on “Default” and choose “Modify”.
  5. Now in the “Value data” box, paste the ftype command you entered earlier in the command prompt, so it looks like the screenshot below, and press OK.
  6. Now do the same thing for the jarfileterm folder (expand jarfileterm > Shell > Open > Comand).
  7. Now exit regedit and launch your .jar file, it should open properly now!
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.