I am looking for the best method to run a Java Application as a *NIX daemon or a Windows Service. I've looked in to the Java Service Wrapper, the Apache Commons project 'jsvc', and the Apache Commons project 'procrun'. So far, the Java Service Wrapper looks like it's the best option... but, I'm wondering if there are any other "Open Source friendly" licensed products out there.
我正在寻找将Java应用程序作为* NIX守护程序或Windows服务运行的最佳方法。我查看了Java Service Wrapper,Apache Commons项目'jsvc'和Apache Commons项目'procrun'。到目前为止,Java Service Wrapper看起来是最好的选择...但是,我想知道是否还有其他“开源友好”许可产品。
3 个解决方案
#1
18
I've had great success with Java Service Wrapper myself. I haven't looked at the others, but the major strengths of ServiceWrapper are:
我自己在Java Service Wrapper上取得了很大的成功。我没有看过其他人,但ServiceWrapper的主要优势是:
- Great x-platform support - I've used it on Windows and Linux, and found it easy on both
- Solid Documentation - The docs are clear and to the point, with great examples
- Deep per-platform support - There are some unique features in the window service management system that are supported perfectly by service wrapper (w/o restarting). And on Windows, you will even see your app name in the process list instead of just "java.exe".
- Standards Compliant - Unlike many ad-hoc Java init scripts, the scripts for service wrapper tend to be compliant with LSB standards. This can end up being very important if you ever want high availability management from something like Linux Heartbeat/HA.
很棒的x平台支持 - 我已经在Windows和Linux上使用它,并且发现两者都很容易
可靠的文档 - 文档清晰明了,并提供了很好的示例
深入的每平台支持 - 窗口服务管理系统中有一些独特的功能,服务包装器(无重启)完全支持。在Windows上,您甚至可以在进程列表中看到您的应用程序名称,而不仅仅是“java.exe”。
符合标准 - 与许多ad-hoc Java init脚本不同,服务包装器的脚本往往符合LSB标准。如果你想要Linux Heartbeat / HA之类的高可用性管理,这可能会变得非常重要。
Anyway, just my 2 cents... :)
无论如何,只是我的2美分...... :)
#2
3
Another option is WinRun4J. This is windows only but has some useful features:
另一个选择是WinRun4J。这只是Windows,但有一些有用的功能:
- 32 bit and 64 bit support
- API to access the event log and registry
- Can register service to be dependent on other services (i.e serviceA and serviceB must startup before serviceC)
32位和64位支持
用于访问事件日志和注册表的API
可以注册服务依赖于其他服务(即serviceA和serviceB必须在serviceC之前启动)
Its also open source friendly (CPL) so no restrictions on use.
它也是开源友好(CPL)所以没有使用限制。
(full disclosure: I work on this project).
(完全披露:我在这个项目上工作)。
#3
1
Are there any special attributes that you need to apply (like OS guided resource management) that you need to support? Otherwise, for Unix you should be able to daemonize your application by writing an appropriate init.d script and setting your app to start automatically.
您需要支持哪些特殊属性(如操作系统引导资源管理)?否则,对于Unix,您应该能够通过编写适当的init.d脚本并将应用程序设置为自动启动来守护应用程序。
#1
18
I've had great success with Java Service Wrapper myself. I haven't looked at the others, but the major strengths of ServiceWrapper are:
我自己在Java Service Wrapper上取得了很大的成功。我没有看过其他人,但ServiceWrapper的主要优势是:
- Great x-platform support - I've used it on Windows and Linux, and found it easy on both
- Solid Documentation - The docs are clear and to the point, with great examples
- Deep per-platform support - There are some unique features in the window service management system that are supported perfectly by service wrapper (w/o restarting). And on Windows, you will even see your app name in the process list instead of just "java.exe".
- Standards Compliant - Unlike many ad-hoc Java init scripts, the scripts for service wrapper tend to be compliant with LSB standards. This can end up being very important if you ever want high availability management from something like Linux Heartbeat/HA.
很棒的x平台支持 - 我已经在Windows和Linux上使用它,并且发现两者都很容易
可靠的文档 - 文档清晰明了,并提供了很好的示例
深入的每平台支持 - 窗口服务管理系统中有一些独特的功能,服务包装器(无重启)完全支持。在Windows上,您甚至可以在进程列表中看到您的应用程序名称,而不仅仅是“java.exe”。
符合标准 - 与许多ad-hoc Java init脚本不同,服务包装器的脚本往往符合LSB标准。如果你想要Linux Heartbeat / HA之类的高可用性管理,这可能会变得非常重要。
Anyway, just my 2 cents... :)
无论如何,只是我的2美分...... :)
#2
3
Another option is WinRun4J. This is windows only but has some useful features:
另一个选择是WinRun4J。这只是Windows,但有一些有用的功能:
- 32 bit and 64 bit support
- API to access the event log and registry
- Can register service to be dependent on other services (i.e serviceA and serviceB must startup before serviceC)
32位和64位支持
用于访问事件日志和注册表的API
可以注册服务依赖于其他服务(即serviceA和serviceB必须在serviceC之前启动)
Its also open source friendly (CPL) so no restrictions on use.
它也是开源友好(CPL)所以没有使用限制。
(full disclosure: I work on this project).
(完全披露:我在这个项目上工作)。
#3
1
Are there any special attributes that you need to apply (like OS guided resource management) that you need to support? Otherwise, for Unix you should be able to daemonize your application by writing an appropriate init.d script and setting your app to start automatically.
您需要支持哪些特殊属性(如操作系统引导资源管理)?否则,对于Unix,您应该能够通过编写适当的init.d脚本并将应用程序设置为自动启动来守护应用程序。