Sorry if this a little dumb, but I have a .jar file that runs great when i type java -jar quiz.jar. But it doesn't work when i just double click on the file. I have it set to open with java.exe, and all my other .jars work fine. it's just the ones i've created. Any Ideas? Thanks.
Asked
Active
Viewed 5,787 times
0
-
2What happens when you double click? – Daniel Kaplan Sep 05 '13 at 23:29
2 Answers
1
What you can do is adding an option in your context menu (using registry). For example, you can copy this code into a .reg file and run it. You should have a "Run Jar" option in your context menu. I did it on my Windows installation and it works great.
[HKEY_CLASSES_ROOT\*\shell\Run Jar]
[HKEY_CLASSES_ROOT\*\shell\Run Jar\command]
@="java.exe -jar %1"
If want to remove this option, create and execute a new .reg file which contains :
[-HKEY_CLASSES_ROOT\*\shell\Run Jar]

Junior Dussouillez
- 2,327
- 3
- 30
- 39
0
Simply by doing:
- right-click on the JAR,
- "Open With...",
- and then select the
javaw.exe
from your JRE'sbin
folder, - tick the "always use the selected program to open this kind of file".
Note that it has to be javaw.exe
, not java.exe
. Do browse to the correct location yourself to make sure.
This alternative should work as well.
-
Yeah, but any other .jar works fine. It's just the ones i've created – Stefan Carlson Sep 06 '13 at 00:04
-
2You have a main class defined in the manifest? (I assume so, considering you can run from the command line you gave) – haylem Sep 06 '13 at 00:08