如何使用WinRun4J将Java应用程序作为Windows服务运行

时间:2013-02-12 13:48:06

标签: java windows windows-services winrun4j

我正在尝试使用WinRun4J将Java应用程序作为Windows服务运行。

我在我的应用程序目录中复制了WinRun4J64c.exe,并将以下service.ini文件放在旁边:

service.class=org.boris.winrun4j.MainService
service.id=MyAPP
service.name=MyAPP
service.description=some description

classpath.1=./lib/*
classpath.2=WinRun4J.jar

[MainService]
class=play.core.server.NettyServer

但是,如果我使用:WinRun4J64c.exe --WinRun4J:RegisterService启动服务,我会得到:

Service control dispatcher error: 1063

有什么问题?

1 个答案:

答案 0 :(得分:2)

我没有让它工作,所以我的解决方法是使用Apache Commons Deamon。我使用以下参数执行了包含的prunsrv.exe:

prunsrv.exe install "MeineAnwendung" \
--Install="C:/pfad/zu/prunsrv.exe" \
--JvmOptions=-Dpidfile.path=NUL
--Jvm=auto \
--Startup=auto \
--StartMode=jvm \
--Classpath="c:/irgendwo/anwendung/lib/*;" \
--StartClass=play.core.server.NettyServer
相关问题