I have an NSIS Script responsible for creating out installer. This installer copies files for our java application then uses prunsvr to install the windows service. When I run this targeting an EXE file built using launch for J, everything works. I want to be able to respond to WSM messages in my application to perform some cleanup / logging. My NSIS script creates the service like so:
ExecWait '"$INSTDIR\prunsrv.exe" "//IS//${Project}" --DisplayName="IPTI ${Project}" --Install="$INSTDIR\prunsrv.exe" --Classpath="$INSTDIR\Host Interface.jar" --StartMode="java" --StartClass="com.ipti.ptl.hostinterfaceservice.HostInterfaceService" --StopMode="java" --StopClass="com.ipti.ptl.hostinterfaceservice.HostInterfaceservice" --Startup="auto" --StartPath="$INSTDIR"'
ExecWait 'net start "IPTI ${Project}"'
The method above fails to create a service that will actually run but this method works fine (targeting an EXE)
ExecWait '"$INSTDIR\prunsrv.exe" "//IS//${Project}" --DisplayName="IPTI ${Project}" --Install="$INSTDIR\prunsrv.exe" --StartMode=exe --StartImage="$INSTDIR\${Project}.exe" --Startup=auto --StartPath="$INSTDIR"'
ExecWait 'net start "IPTI ${Project}"'
I added the following to my main method to work with the prunsvr when not targeting an EXE:
public static void main(String[] args) throws Exception {
Common.deployResources();
if (args.length > 0 && args[0].equals("start")) {
HostInterfaceService hi = new HostInterfaceService();
hi.launch();
}
else {
System.exit(0);
}
}
I have also tried using start and stop methods specified with --StartClass --StartMethod --StopClass and --StopMethod.
No matter what I try, I invariably get an error. When I try to start from the service manager I get error code 1 or 4. No other information at all. What am I doing wrong?
My event viewer shows only:
The IPTI Host Interface service terminated with service-specific error Incorrect Function.