I just created a jar file using jdk7. I tried to run it, but kept getting an error message. It turned out that this was pointing to jre6, not jdk7. So I used the following command to change it
ftype jarfile = "C: \ path to jre \ bin \ javaw.exe" -jar "% 1"% *
After that, I tried to double-click on my jar file, but he pulled out a window asking me to select a program to open it. When I selected the same javaw.exe file as above, it starts, but exits immediately, doing nothing. I can run it in cmd by running java -jar file.jar command. I even tried to remove the .jar registry key, but that only returned me to the moment when he asked me to choose a program to open. I use Windows 7 if that matters.
EDIT: There are 3 subkeys in the registry: OpenWithList, OpenWithProgids and UserChoice. I changed all the defaults to the path above, except for UserChoice, which will not allow me to edit it from regedit. When I delete this and try to run the jar file, it will open a program that opens again with a window. For some reason, it ignores other registry keys.
source share