Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Start Application built on NetBeans Platform doesn't create desktop shortcut & start menu item

I've created a NetBeans Platform application that is launched using Java Web Start. I built the WAR file using the 'Build JNLP Application'-command in Netbeans 6.8.

I've added a desktop shortcut and menu item to the JNLP file, but for some reason, these are not created when the application is launched.

However, when I go to:

Control Panel -> Java -> Temporary Internet Files -> View -> Select my application > Click 'Install shortcuts to the selected application'

the desktop and menu shortcuts are created correctly.

Also, in the Java Console, the Shortcut Creation option is set to the following (the default, I presume):

  • Prompt user if hinted

Below is a snippet of my JNLP file:

<jnlp spec="6.0+" codebase="$$codebase">   
      <information>
         <title>${app.title}</title>
         <vendor>SomeVendor (Pty) Ltd</vendor>
         <description>Some description</description>
         <icon href="${app.icon}"/>      
         <shortcut online="true">
            <desktop/>
            <menu submenu="MyApp"/>
         </shortcut>   
      </information>
      ...

I'm stumped. Does anybody have an explanation for this? Thanks

PS This is on both Windows XP and Windows 7. NetBeans version: 6.8

like image 243
rudolfv Avatar asked Apr 30 '10 13:04

rudolfv


People also ask

How do I create a desktop shortcut in Visual Studio?

In explorer, open the folder "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" and copy the shortcut "Visual Studio 20xx" onto the desktop.


3 Answers

I managed to resolve this by using the javax.jnlp.IntegrationService (available since JDK 6.1.18).

This class can be found in the jnlp.jar found in the JDK samples directory: /sample/jnlp/servlet/jnlp.jar

The following code ensures that the desktop shortcut and menu shortcut are created:

    private void createShortcuts() {
        IntegrationService vIntegrationService = null;
        try {
            vIntegrationService = (IntegrationService) ServiceManager.lookup("javax.jnlp.IntegrationService");

            if (!vIntegrationService.hasDesktopShortcut() || !vIntegrationService.hasMenuShortcut()) {
                vIntegrationService.requestShortcut(true, true, "App Menu Name");
            }
        } catch(UnavailableServiceException ex){
            ex.printStackTrace();
        }
    }
like image 181
rudolfv Avatar answered Sep 28 '22 09:09

rudolfv


I have the same issue with Linux, but it works as expected on OS-X. I have tested with both the Tomcat and the Jetty web container.

So, it's a fair chance that your code is actually correct.

like image 30
Espen Avatar answered Sep 28 '22 07:09

Espen


I have the same problem using Eclipse to build a WebStart application. I figured it was a limitation of WebStart on Windows. I figured you can set those properties, but the user still needs to "install" the app to use them.

It's a bit easier to install on the Mac. You just right click on the icon in your dock, click on Options and then Keep in Dock.

like image 40
Marcus Adams Avatar answered Sep 28 '22 08:09

Marcus Adams