K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
K. Tsang wrote:Instead of converting the class file to exe why not just create a batch (bat) file and say "java MyServer" and the windows service point to the batch file.
Martin Vajsar wrote:
Another possibility would be to use Windows task scheduler - it might be nearly as good as a service without the need to create one. But obviously, some amount of setup will always be needed to run an application on a remote server
Claude Moore wrote:
I don't know how sc create command works, but on the base of the error you posted, I would say that the problem is that the equivalent of onStart() method doesn't terminate (or, better: it doesn't return control to SO) in a reasonable quantum of time. I don't know even how Launch4J works, I can only suppose that it uses main() method as entry code. You should try to review your main method and verify if you can start a daemon thread there.
Ashwin Raghavan wrote:
Martin Vajsar wrote:
Another possibility would be to use Windows task scheduler - it might be nearly as good as a service without the need to create one. But obviously, some amount of setup will always be needed to run an application on a remote server
The thing is i want the program to run automatically when system reboot happens. so i thought making it into a service is the best way to where in we can just make start = auto.
Claude Moore wrote:
I don't know how sc create command works, but on the base of the error you posted, I would say that the problem is that the equivalent of onStart() method doesn't terminate (or, better: it doesn't return control to SO) in a reasonable quantum of time. I don't know even how Launch4J works, I can only suppose that it uses main() method as entry code. You should try to review your main method and verify if you can start a daemon thread there.
Ashwin Raghavan wrote:I can make the main method return some output. right now it sends void. Can you tell me the exit codes which is returned back when the service is created.
.NET is different from Java. Since it is created by Microsoft, I believe (but might be also wrong) that .NET has built-in support for Windows services, whereas Java doesn't. There are Java frameworks that add this support, but the OP has already stated he doesn't want to use them.
Claude Moore wrote:By the way: which Java frameworks allow you to write OS services ? I'd like to know more about.
It's a tiny ad only because the water is so cold.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|