java - Apache Commons Daemon - 无法启动服务

标签 java windows-services jvm

我可以使用 Apache Commons Daemon 工具安装、卸载和运行我的服务作为控制台应用程序。问题是当我尝试将我的应用程序作为服务运行时,服务状态不会从停止切换到运行。

用于安装服务的脚本:

prunsrv.exe install ServiceName --DisplayName="Some Display Name" --Classpath %cd%\daemon.jar --Install=prunsrv.exe --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=Main --StartParams start --StopClass=Main --StopParams stop

我在 Windows 8 - 64 位中运行该服务。

对可能出现的问题有什么想法吗?

编辑: 在 services.msc 中运行应用程序时,我收到以下消息:

Windows could not start the [Service Name] service on Local Computer
Error 2: The system cannot find the file specified.

编辑2: 在 Windows 7-64 位中尝试过。同样的问题。

最佳答案

问题是 Windows 找不到 prunsrv.exe 文件。在安装文件夹中,必须指定可执行文件的完整路径。

关于java - Apache Commons Daemon - 无法启动服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25241550/

相关文章:

c# - 如何从 ServiceController 确定 Windows.Diagnostics.Process

jenkins - 更新后无法在Windows中启动Jenkins服务

java - Java如何保留/使用内存?

java - 具有 Zookeper 服务器的集群环境中的 FTP 入站适配器

java - 知道 future 是否开始

java - 在 liferay 的不同页面上显示导航菜单?

java - 相同的应用程序部署在两个不同的服务器上,但从数据库中获取相同的数据。如何同步数据库数据

powershell - 使用 PowerShell 获取 Windows 服务的启动类型

time - System.currentTimeMillis() 如何获取时间

scripting - JVM/BSF 是否有任何真正简单/有限的脚本语言?