How to recreate shortcut to webstart application?

räph picture räph · Aug 26, 2009 · Viewed 11.9k times · Source

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)

Answer

Dreen picture Dreen · Mar 5, 2013

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
}