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.

Comments

24
    EO
    Emel Oliver Aug 8, 2018

    What do i do if there is no jar_auto_term?

    SQ
    SQLSouthwood Aug 20, 2018

    That powershell trick worked perfectly for me. Thanks!

    K0
    Kernel3.0 Feb 10, 2019

    I’m running into an issue on step 4, I can’t replace C:Program Filesetc with C:Program Files (x86)Javajre1.8.0_***binjava.exe it tells me Invalid Switch – C:Program and I’ve tried taking out the spaces but that obviously doesn’t work because that’s not the same thing, anyone know what I can do

      SW
      Shane Warren Author Sep 19, 2019

      You need to replace it with the location of your Java directory. You can do so by opening it and then double-clicking on the address in the top and copying and pasting it.

    B
    Brigi K. May 11, 2019

    I tried both method still not working unfortunately 🙁 any other suggestion please?

      SW
      Shane Warren Author Sep 13, 2019

      Try this “Reinstall JRE and check if it solves the issue.
      Alternatively, you can check out a solution posted on the StackOverflow forums:
      “Open the Windows Explorer, from the Tools select ‘Folder Options…’
      Click the File Types tab, scroll down and select JAR File type.
      Press the Advanced button.
      In the Edit File Type dialog box, select open in Actions box and click Edit…
      Press the Browse button and navigate to the location the Java interpreter javaw.exe.
      In the Application used to perform action field, needs to display something similar to C:Program FilesJavaj2re1.4.2_04binjavaw.exe” -jar “%1″ % (Note: the part starting with ‘javaw’ must be exactly like that; the other part of the path name can vary depending on which version of Java you’re using) then press the OK buttons until all the dialogs are closed.””

    JE
    James Eversole Jun 23, 2019

    Hey having some trouble on my end. Not sure the instructions were clear enough. Could you give full examples of the thing you’re supposed to paste in reg edit if the location of the folder, were, say “C:Program Files (x86)Javajre1.8.0_211binjava.exe”

    SW
    Shane Warren Author Jun 25, 2019

    ftype jarfileterm=cmd /s /k “”C:Program Files (x86)Javajre1.8.0_211binjava.exe”-jar “%1″ %*”
    assoc .jar=jarfileterm (this is what you are supposed to paste)

    Reply
      FF
      First Choice Services Fcs Aug 29, 2019

      is this two seperate commands? I assume it is. and if so which line do I add the to regedit?

        SW
        Shane Warren Author Aug 31, 2019

        Enter This command “ftype jarfileterm=cmd /s /k “”C:Program FilesJavajre7binjava.exe” -jar “%1″ %*””

    NL
    Nikko Leonard Jul 13, 2019

    even after doing this still not working, and in regedit i dont have jar_auto_file

      SW
      Shane Warren Author Sep 10, 2019

      Reinstall JRE and check if it solves the issue.
      Alternatively, you can check out a solution posted on the StackOverflow forums:
      “Open the Windows Explorer, from the Tools select ‘Folder Options…’
      Click the File Types tab, scroll down and select JAR File type.
      Press the Advanced button.
      In the Edit File Type dialog box, select open in Actions box and click Edit…
      Press the Browse button and navigate to the location the Java interpreter javaw.exe.
      In the Application used to perform action field, needs to display something similar to C:Program FilesJavaj2re1.4.2_04binjavaw.exe” -jar “%1″ % (Note: the part starting with ‘javaw’ must be exactly like that; the other part of the path name can vary depending on which version of Java you’re using) then press the OK buttons until all the dialogs are closed.”

      Reply
    SW
    Shane Warren Author Sep 26, 2019

    Try this:
    “Reinstall JRE and check if it solves the issue.
    Alternatively, you can check out a solution posted on the StackOverflow forums:
    “Open the Windows Explorer, from the Tools select ‘Folder Options…’
    Click the File Types tab, scroll down and select JAR File type.
    Press the Advanced button.
    In the Edit File Type dialog box, select open in Actions box and click Edit…
    Press the Browse button and navigate to the location the Java interpreter javaw.exe.
    In the Application used to perform action field, needs to display something similar to C:Program FilesJavaj2re1.4.2_04binjavaw.exe” -jar “%1″ % (Note: the part starting with ‘javaw’ must be exactly like that; the other part of the path name can vary depending on which version of Java you’re using) then press the OK buttons until all the dialogs are closed.”

    ON
    onefan99 Oct 6, 2019

    when i open the powershell admn, the code says /windows/system32>
    do i input the commands therealso when i looked for the .jar_auto_files and jarfileterm i could not find them at all

    SW
    Shane Warren Author Oct 10, 2019

    Make sure you are updated with the latest version of Java Runtime Environment:
    https://java.com/en/download/
    Also, yes you do input the commands there, the prewritten code shouldn’t matter.

    DA
    Dashy Dec 8, 2019

    I can’t find jar_auto_file

      SW
      Shane Warren Author Dec 12, 2019

      Make sure that you have an updated version of Java and that none of the files are missing.

    WI
    WindyGamer Apr 22, 2020

    These days java jar files run directly. I typed the name of the jar file into a command prompt and it ran. My problem is that I can’t see any of the “Console” output from the program. Any insights about how to direct the console output of the program System.out.println() to the terminal window? Nothing is showing now.
    thanks.

      SW
      Shane Warren Author Apr 26, 2020

      Do u mean the Java Console Output? that can be done by going into Java Control Panel > Advanced > Java Console > Show Console.

    FH
    faqih arsy hikmatyar Jul 27, 2020

    im installing my java on drive F:, is it can make error effect to java?
    i did all of method but still won’t open

      SW
      Shane Warren Author Jul 29, 2020

      Install Java on the root drive on which Windows is installed.

    KE
    Kev Aug 19, 2020

    I dont have jar auto file and its still not working

      SW
      Shane Warren Author Aug 20, 2020

      Can you please elaborate? you don’t have the Jar Auto File registry key?

    ML
    Martin Law Mar 26, 2021

    One of my JarFIle cannot change to : Executable Jar File because my file/folder was corrupted!