使 WebStart Java 桌面应用程序在 Windows 和 Mac 上的系统启动时启动

发布于 2024-08-31 08:39:42 字数 997 浏览 3 评论 0原文

我开发了小型跨平台(Windows 和 Mac)SWT 桌面应用程序。它随 WebStart 一起分发。到目前为止一切顺利,一切正常。

我有一个新要求,要求我的应用程序在系统启动时启动(无需用户交互)。实现这一目标的最佳方法是什么?

在 JNLP 文件中,我得到了这个:

<shortcut online="false">
    <desktop/>
    <menu submenu="CompanyName"/>
</shortcut>

在 Windows WebStart 创建一个桌面链接 [app_name].lnk 并指向 javaws.exe ,然后是一些 Java 缓存文件作为参数,其名称很有趣,例如 ..\Sun\Java\Deployment\cache\6.0\4\2c0a6a781-213476。我可以通过编程方式按名称在用户计算机上找到该链接...呃...然后将其复制到用户的 Startup 文件夹中。我可以在这里看到一个问题,因为用户可以一起禁用 WebStart 桌面快捷方式创建选项。

在 Mac 上,WebStart 会弹出一个对话框,提示用户创建启动应用程序的 [app_name].app(用户可以在那里更改链接名称!)文件的位置。在 Mac 上,我不知道 Startup 文件夹位于何处(而且那里似乎要复杂得多)。

是否有 Java 库可以像 SWT 那样在不同平台上抽象在系统启动时启动应用程序概念?

I developed small cross-platform (Windows and Mac) SWT desktop application. It is distributed with WebStart. So far so good, everything works.

I've got a new requirement to make my app start on system startup (with no user interaction). What is the best way to accomplish that?

In JNLP file I've got this:

<shortcut online="false">
    <desktop/>
    <menu submenu="CompanyName"/>
</shortcut>

On Windows WebStart creates a desktop link [app_name].lnk and it points to
javaws.exe and then some Java cache file as a parameter with funny name like ..\Sun\Java\Deployment\cache\6.0\4\2c0a6a781-213476. I can possibly programmatically find that link on user's machine by name... erm... and then copy it into user's Startup folder. I can see a problem here though as user can disable WebStart desktop shortcut creation option all together.

On Mac WebStart pops up a dialog to prompt user for the location where to create an [app_name].app (user is allowed to change link name there!) file that launches an application. On Mac I don't event know where the Startup folder is located (and it seems to be much more complex there).

Is there Java library out there that abstracts start app on system startup concept on different platforms as SWT does for GUI abstraction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

恍梦境° 2024-09-07 08:39:42

有,但它很新,所以还没有广泛使用。

引入了 IntegrationService在 1.6.0u18 中。感兴趣的方法是 请求快捷方式

There is, but it's very new, so it's not widely available.

The IntegrationService was introduced in 1.6.0u18. The method of interest is requestShortcut.

一曲爱恨情仇 2024-09-07 08:39:42

您可以查看Java Service Wrapper。这可以将您的程序连接为 Windows 服务。

You can take a look at Java Service Wrapper. This can wire your program as a windows service.

执笏见 2024-09-07 08:39:42

撞!

似乎 http://yajsw.sourceforge.net/ 是当前实现此目的的活跃项目。

Bump!

Seems like http://yajsw.sourceforge.net/ is the currently active project that achieves this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文