How to recreate shortcut to webstart application?
Asked Answered
H

4

10

I use the shortcut tag in my appliation's jnlp descriptor to create a desktop link and a menu entry for my application.

If these shortcuts get deleted on the client - how can they be reinstalled automatically without user action? Is there a configuration option for the jnlp file?

(btw I'm using java6)

Habile answered 26/8, 2009 at 5:37 Comment(1)
if someone got a solution, i'm interested too! thanks!Rottweiler
A
5

Here is a skeleton of an automatic way (you need javaws.jar in your classpath for this to work):

IntegrationService is = null;
try
{
    is = (IntegrationService) ServiceManager.lookup("javax.jnlp.IntegrationService");
}
catch (UnavailableServiceException use)
{
    // integration service unavailable
}

if (!is.hasDesktopShortcut())
{
    if (!is.requestShortcut(true, true, "Companyapp"))
    {
        // failed to install shortcuts
    }
}
else
{
    // shortcuts already exist
}
Alie answered 5/3, 2013 at 10:12 Comment(0)
C
3

Please refere this link - http://mindprod.com/jgloss/javawebstart.html

SUMMARY:If you want JWS to recreate menu and/or desktop shortcuts, delete both the menu item and the desktop icon, then run javaws -viewer on the command line then click the button to create the shortcuts. If either one exists, javaws.exe won’t create the other. It also might not create them where you were expecting, so look around.

Cimbura answered 26/8, 2009 at 5:45 Comment(1)
thanks! this works, BUT: in the described way the user needs to do this manually on the client - it would be better if this could be done automatically, e.g. that during launching from the web, java checks if the shortcuts exists - and if not, installs them!Merow
G
3

The docs for Java6 on javaws show that you can either use the executable to launch an app or to perform maintenance operations they call control options.

Two of those options are:

javaws -uninstall <jnlp>
javaws -import [import-options] <jnlp>

one of the things you can do is

javaws -import -silent -shortcut <jnlp>

So if you can run a script that first uninstalls your particular jnlp app and then silently re-imports it and its shortcuts then that would solve your problem. I don't think Java will automatically do this for you.

Note that the documentation says that it has to be a silent installation for the shortcut option to work. Also, I haven't double checked that this actually works myself.

Gink answered 10/5, 2012 at 7:45 Comment(0)
O
1

I just wanted to add a comment on the above solution, in case it saves anyone time.

IF your application is installed in the WebStart cache, but the shortcut has been removed (like during a java update, or the user removes) the javaws -import -silent -shortcut will NOT just recreate the shortcut for the application. At least for 1.6.0_u35 and u37.

It seems as though WebStart checks to see if the application is in the cache, if it is, it just exits WITHOUT creating the shortcut. Very disappointing...

Ofris answered 7/11, 2012 at 17:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.