基于NetBeans平台构建的Web Start应用程序不会创建桌面快捷方式&开始菜单项 [英] Web Start Application built on NetBeans Platform doesn't create desktop shortcut & start menu item

查看:93
本文介绍了基于NetBeans平台构建的Web Start应用程序不会创建桌面快捷方式&开始菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个使用Java Web Start启动的NetBeans Platform应用程序.我在Netbeans 6.8中使用构建JNLP应用程序"命令构建了WAR文件.

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.

我已经在JNLP文件中添加了一个桌面快捷方式和菜单项,但是由于某些原因,在启动应用程序时不会创建这些快捷方式.

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.

但是,当我去:

控制面板-> Java->临时 Internet文件->视图->选择我的 应用程序>单击安装快捷方式 到所选的应用程序

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.

此外,在Java控制台中,快捷方式创建"选项设置为以下内容(默认,我认为是这样):

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

  • 提示时提示用户

以下是我的JNLP文件的摘要:

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这在Windows XP和Windows 7上均适用.NetBeans版本:6.8

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

推荐答案

我设法使用javax.jnlp.IntegrationService(自JDK 6.1.18开始提供)解决了这个问题.

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

此类可在JDK示例目录的jnlp.jar中找到: /sample/jnlp/servlet/jnlp.jar

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();
        }
    }

这篇关于基于NetBeans平台构建的Web Start应用程序不会创建桌面快捷方式&amp;开始菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆