File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help with Executable Jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with Executable Jar" Watch "Help with Executable Jar" New topic

Help with Executable Jar

Brian Yingling

Joined: Feb 15, 2004
Posts: 6
I've created a executable Jar file on Windows XP. While I can execute the jar file at the command line (java -jar foo.jar) I can't seem to have the file execute when double-clicking on the icon. I haven't been able to figure out the problem. Can anyone help me?
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I'd guess that the file associations that your operating system is using for .jar files aren't configured properly to be able to run execute a JAR by double-clicking on it.
You can try to configure this setting manually, or you could try to remove the file association completely and then reinstall the JRE or J2SDK.
My setting, which works for me, for the action to take when double-clicking a JAR file is
"D:\Program Files\Java\j2re1.4.2_03\bin\javaw.exe" -jar "%1" %*
If you need more detailed help on changing this setting, just ask.
[ February 15, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Brian Yingling

Joined: Feb 15, 2004
Posts: 6
Hi Dirk,
I've removed the file association and reinstalled the JDK and it still doesn't work. Here's the path associated with the Jar file:
"C:\Program Files\Java\j2re1.4.2_03\bin\javaw.exe" -jar "%1" %*
Thanks for your help, but I'm not sure what else to do. I'm at a loss.
I agree. Here's the link:
subject: Help with Executable Jar
It's not a secret anymore!