How to run .jar file by double click on Windows 7 64-bit?

Running a .jar file in a command line works fine, but i am not able to run any .jar file by double clicking on my Windows 7 (64). It seems nothing happens after the double click.

I tried the ftype hint, no success:

ftype jarfile="C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*

I reinstalled the JDK 7 64-bit, no success.

Any idea?


Solution 1:

If you have previously used the right click and opened with \path\to\your\javaw.exe then you will need to remove the following registry key.

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar]

Then run

C:\>assoc .jar=jarfile
C:\>ftype jarfile="C:\path\to\your\javaw.exe" -jar "%1" %*

Solution 2:

What is listed in right-click-> Open With ? Is some other program listed as the default program ? Is a Java Runtime listed ? If a Java Runtime is listed, you can open with it, and make it the default program to run with.

ie,

Right Click ->  Properties -> Change -> C:\Program Files\Java\jre7\bin\javaw.exe

Solution 3:

You may also run it from the Command Prompt (cmd):

java.exe -jar file.jar

Solution 4:

For Windows 7:

  1. Start "Control Panel"
  2. Click "Default Programs"
  3. Click "Associate a file type or protocol with a specific program"
  4. Double click .jar
  5. Browse C:\Program Files\Java\jre7\bin\javaw.exe
  6. Click the button Open
  7. Click the button OK