Reputation: 5101
I was used to hyperlink to a jar file on my server, which then was downloaded and opened without requiring further user-side actions.
<a href="demo.jar">Run Demo</a>.
With Firefox (current version 14) I can only store it and run it manually. I have tried to set the JDK for the jar filetype via Firefox -> Preferences- -> Contents -> Runnable Jar
, but then javaw.exe demo.jar
is invoked. Obviously it should be javaw.exe -jar demo.jar
but I have found no option to set this argument.
How can I run the jar file directly by clicking on the hyperlink?
Edit: I have 50+ such jar files, using WebStart is not an option.
Upvotes: 0
Views: 8208
Reputation: 31
Another option is to create a shortcut (.lnk) to the jar. The shortcut's file path can then be a added as a hyperlink. This way you can also specify additional arguments (parameter) to the Java application by modifying the target field of the shortcut properties. See the following example settings in the shortcut properties.
Target: C:\WINDOWS\system32\javaw.exe -Xmx900m -jar demo.jar
Start in: W:\DemoFolder
The only catch is that some Windows 7 (IE9) users are not able to launch the application using the hyperlink and so prefer to use the shortcut. I have just started investigating the issue. But perhaps someboody else already knows what the issue could be.
Upvotes: 3
Reputation: 5101
I found a working solution myself. Windows only, but there might be a similar solution under other OS.
Under Windows, just set the set explorer.exe
for the jar filetype via Firefox -> Preferences -> Contents -> Runnable Jar
. Jar files will then be directly started when clicking on their hyperlink.
Upvotes: 2
Reputation: 1060
Why not consider making you application use Java Web Start to run instead?
It might be a bit more work but if you are going to start from the web. imo it feels like a more correct solution.
Here is some initial read that might be helpful: http://www.oracle.com/technetwork/articles/javase/index-135962.html
Upvotes: 1
Reputation: 8207
make another exefile (Suppose ABC.exe) from a bat file (Tools readily available), and let it be middle man, which invokes
java -jar %1
Instead of javaw.exe set it as ABC.exe.
Upvotes: 2