Is it possible to restart a Java application Service with install4j ?
I need to change some configurations in the application and then restart it in unattended mode using the api. (Not doing the complete install or update)
I found this answer that would work if the application is not a service: https://stackoverflow.com/a/65777281/150566 I tried to do the same thing using a Custom Application but using Service call like this:
I've also tried without the request privileges and without sleep with same result or using the stop service commandHalf of it works. The service stops but the Service never restart.
Is there something missing so that the service can start again ? Is there other alternative ?
Updated info:
The config is changed as mentioned to stop the service instead of ShutDown calling launcher:
When using debug as mentioned by Ingo Kegel those output are the result:
Called from mylauncher Service with the Api (not working):
[INFO] com.install4j.runtime.beans.actions.services.StopServiceAction [ID 147]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property windowsStopMinimumWaitTime: 30000
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
Stop minimum wait time: 30000
Called from command line (working):
[INFO] com.install4j.runtime.beans.actions.services.StopServiceAction [ID 147]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property windowsStopMinimumWaitTime: 30000
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
Stop minimum wait time: 30000
previous state true
Execute action successful after 519 ms
[INFO] com.install4j.runtime.beans.actions.services.StartServiceAction [ID 148]: Execute action
Property executable: null
Property launcherId: 36
Property serviceName: null
Property autostartOnly: false
Property rollbackSupported: true
usedExecutable: C:\MyInstaller\mylauncher.exe
previous state false
Execute action successful after 44 ms
[INFO] com.install4j.runtime.beans.screens.StartupScreen [ID 131]: command: move 1 screens, executing actions, checking condition
[INFO] cleaning up
[INFO] Finished at 2023-02-06 15:06:06
(I've also tried without the request privileges and without sleep with same result or using the stop service command)