How to recreate shortcut to webstart application?

12,122

Solution 1

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
}

Solution 2

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.

Solution 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.

Solution 4

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...

Share:
12,122

Related videos on Youtube

räph
Author by

räph

Updated on June 04, 2022

Comments

  • räph
    räph about 2 years

    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)

  • räph
    räph almost 15 years
    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!