1

java -jar file.jar works fine, but if I double click on it nothing happens.

I've tried everything I could find but nothing seems to fix this. I've checked regedit, file associations, uninstalled oracle java and tried open jdk, tried different version of java, etc. The problem remains.

Regedit has HKEY_CLASSES_ROOT\jarfile\shell\open\command correctly set. File associations on windows are also correctly set. When I double click on the jar file, java runs (a cmd window quickly appears and then disappears) but nothing happens.

> java --version
java 15.0.1 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

> assoc .jar
.jar=jarfile

> ftype jarfile
jarfile="C:\Program Files\Java\jdk-15.0.1\bin\java.exe" -jar "%1" %*

How can I fix this so that I can open the file by double clicking on it?

15
  • 1
    "I've checked regedit, file associations" .. not enough information here.. checked WHAT? .. I ask because your answer lies in the association of .jar files and nothing else. Dec 28, 2020 at 17:23
  • 1
    COOL! Now we are cooking but you need to put that in your question, not a comment (for later).. You are correct about where your base association go but Microsoft added another STUPID layer of associations under HKCU. Lemme figure out where those are again.. Dec 28, 2020 at 17:34
  • 1
    I have your solution. If it works, post it for yourself.. wait a couple of days and accept your own answer (you need the points and I am lazy). You want to go to Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar and look there. :) I myself would delete this key. That should force the associations back to the HKCR key you mention.. back it up if you want.. or you can figure out the new registry keys in the location I mention. Dec 28, 2020 at 17:39
  • 1
    Poke around Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileAssociation and see if there is a clue there as to what is happening. If that doesn't help, there is always the tried and true process monitor and snooping what keys the explorer is looking at. Dec 28, 2020 at 18:47
  • 1
    OH! And duhhhh (on my part).. HKEY_CLASSES_ROOT\jarfile\shell\open\command doesn't mean anything if Computer\HKEY_CLASSES_ROOT\.jar isn't pointing to jarfile Dec 28, 2020 at 18:51

1 Answer 1

3

Thanks to @SeñorCMasMas for helping me solve the problem.

Editing HKEY_CLASSES_ROOT\.jar to point to jarfile instead of .jar_auto_file fixed the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .