java background / daemon / service跨平台最佳实践 [英] java background/daemon/service cross platform best practices

查看:126
本文介绍了java background / daemon / service跨平台最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找让我的桌面java程序在大多数平台(Windows,Mac OS,Linux [特别是Ubuntu])中在后台(守护程序/服务?)运行的最佳方法。

I am looking for the best way to make my desktop java program run in the background (daemon/service?) across most platforms (Windows, Mac OS, Linux [Ubuntu in particular]).

通过最佳方式,我希望找到一种方法:

By "best way" I am hoping to find a way that will:


  1. 需要最少数量的特定于平台的代码。

  2. 不要求用户做任何普通计算机用户不能/不会做的事情

  3. 不是资源匮乏。

  1. require a minimum amount of platform-specific code.
  2. not require the user to do anything a general computer user couldn't/wouldn't do
  3. not be a resource hog.

我理解我的要求可能不切实际,但我希望在这种情况下有某种最佳做法。

I understand that my requirements may be unrealistic but I am hoping there is some sort of "best practice" for this type of situation.

如何前进?

推荐答案

你可以使用 SystemTray 类并在默认情况下安装您的应用程序平台。

You can use the SystemTray classes and install your app as any other in the default platform.

对于Windows,它可能是在启动时运行的计划任务。
对于Linux和OSX我不知道(除了crontab,它在某种程度上太技术了)但我很确定他们都有办法轻松地做同样的事情。

For windows it could be an scheduled task that run at startup. For Linux and OSX I don't know (besides crontab wich is somehow too technical) but I'm pretty sure they both have a way to do the same thing easily.

不幸的是(截至今天)Apple尚未完成1.6端口。

Unfortunately (as of today) Apple hasn't finished the 1.6 port.

它不是真正的恶魔,而是Google桌面等应用。

It won't be a real demon, but an app like Google Desktop.

我听说Quartz是个不错的选择。但我从未使用它。

I've heard Quartz is a good option. But I've never used it.

这篇关于java background / daemon / service跨平台最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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