java - Procrun 找不到服务的注册表项

标签 java batch-file procrun

我试图让我的程序成为一项服务,所以我从 http://commons.apache.org/proper/commons-daemon/procrun.html 找到了 procrun但我做了一个 installService.bat 并在尝试运行时不断收到相同的错误消息

./prunsrv.exe //TS//InkEstService

错误代码是这样的

[2016-06-15 09:44:06] [warn]  [ 7136] The system cannot find the Registry key for service 'InkEstService'
[2016-06-15 09:44:06] [error] [ 7136] Load configuration failed
[2016-06-15 09:44:06] [error] [ 7136] The system cannot find the file specified.
[2016-06-15 09:44:06] [error] [ 7136] Commons Daemon procrun failed with exit value: 2 (Failed to load configuration)
[2016-06-15 09:44:06] [error] [ 7136] The system cannot find the file specified.

我的installService.bat如下

set SERVICE_NAME=InkEstService
set PR_INSTALL=C:\Users\TStraley\Desktop\commons-daemon\prunsrv.exe

REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=c:\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=Error

REM Path to java installation
set PR_JVM=C:\Program Files\Java\jdk1.8.0_92\jre\bin\server\jvm.dll
set PR_CLASSPATH=C:\Users\TStraley\Desktop\Ink/Estimator\InkDataCollection.jar

REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=Platform.Platform
set PR_STARTMETHOD=start

REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=Platform.Platform
set PR_STOPMETHOD=stop

REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000

REM Install service 
prunsrv.exe //IS//%SERVICE_NAME%

我一直在关注 https://joerglenhard.wordpress.com/2012/05/29/build-windows-service-from-java-application-with-procrun/ 上提供的教程...任何想法将不胜感激!

最佳答案

您需要将 prunsrv.exe 重命名为与您的服务相同的名称,即“InkDataCollection.exe”

我已经尝试过了,它对我有用。

关于java - Procrun 找不到服务的注册表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37840579/

相关文章:

java - 使用 Selenium IEDriverServer 的文本输入速度非常慢?

java - .forward() 然后 resp.sendRedirect() 与 servlet

windows - 如何在 Windows 批处理文件中嵌入文本文件

windows - 批处理文件: How to Double Quote a Command/C when the command itself needs Quotes

java - 如何创建等于某个值的整数数组?

java - GWT Guice/Gin 在服务器端的问题

java - 如何在 Windows 上远程启动 Tomcat

daemon - Apache 公共(public)守护进程 "Failed creating Java"错误

java - Windows 服务登录前访问网络