Java application will run from CMD and Eclipse but not double click

cmd, compilation, executable-jar, java, windows

Solution

Some registry values or file associations are probably messed up. Wiping off all of your existing JRE's and JDK's and re-installing them should fix your issue.

Alternatively you may be able to fix it by manually editing the registry value here: `HKLM > SOFTWARE > Classes > jarfile > shell > open > command` My value is

Type: `REG_SZ`

Data: `"C:\Program Files\Java\jre8\bin\javaw.exe" -jar "%1" %*`

You'd of course want that path to point to your javaw.exe, and make sure you have the additional arguments.

Problem

I've done a search and I can see that a lot of people have had the same problem as me, but none of the solutions have worked for me. Basically I have a Java Project in Eclipse that is from my old Windows Installation. I've cleaned and rebuilt it because at first it wouldn't compile, but now I have it exported as a Runnable Jar. However, the only way I can get the application to appear is to do `java -jar foo.jar` in command prompt, or run it in Eclipse. If I double click the JAR in Windows Explorer nothing happens even though I know that Java is associated correctly because other Runnable Jars work. The project only has the x86 JRE listed in it's Build Path Libraries and all the files listed appear to exist. I'm running Windows 7 HP. Update: I'm sorry, but I just discovered that no other Runnable Jars are working either. If they are wrapped with launch4j they work though... Edit: The Runnable Jars that I export from Eclipse do work fine on other systems and load on double click

Original source

Related problems