以下代码在Java中用于创建Windows服务。
当我用jar运行批处理文件时,它将安装服务作为系统。 任何人都可以帮助如何以当前用户的身份安装服务?
user =" xyz"
是否需要Windows登录密码?
process = Runtime.getRuntime().exec(new String[] { installFolder+"/UninstallerAgent.exe",
"//IS//UninstallerAgent",
"--Install=" + installFolder + "/Uninstaller.exe",
"--DisplayName=UninstallerAgentv1.1",
"--Jvm=" + installFolder + "/runtime/bin/j9vm/jvm.dll",
"--Classpath=" + installFolder + "/UninstallerAgent.jar",
"--Startup=auto",
"--StartMode=jvm",
"--StartClass=com.uninstaller.Main",
"--StartMethod=\"start\"",
"--StartParams=\"start\"",
"--StopMode=jvm",
"--StopClass=com.uninstaller.Main",
"--StopMethod=\"stop\"",
"--StopParams=\"stop\"",
"--LogLevel=Error",
"--LogJniMessages=0",
"--LogPath="+installFolder,
"--LogPrefix=\"UninstallerAgentService\"",
"--StdOutput=auto",
"--StdError=auto",
"--Description=\"Local Probe for finding IP and Serial ID\""
});