开发者

Make WebStart Java desktop application to start on system startup on Windows and Mac

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 comp开发者_运维技巧lex there).

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


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.


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


Bump!

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜