Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recreate shortcut to webstart application?

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)

like image 635
räph Avatar asked Aug 26 '09 05:08

räph


3 Answers

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
}
like image 198
Dreen Avatar answered Oct 19 '22 19:10

Dreen


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.

like image 40
KV Prajapati Avatar answered Oct 19 '22 17:10

KV Prajapati


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.

like image 3
Jim Avatar answered Oct 19 '22 19:10

Jim