1

Actually I am having one java program. That returns "Hello World". I converted it to jar file. After that I changed the file type as .exe with the use of iexpress in my windows XP default sw.

I used the sc create command, for creating new service. I created the windows service successfully. But the thing is I am not able to run this. It is throwing the following error.

enter image description here

This error is coming not only for this javaservice.

I tried to run the chrome.exe as windows service, That time also it is throwing the same error.

Is it windows constraints? or Am I making mistake? Expecting the solution.,

Thanks in Advance...

Ramkumar
  • 864
  • 11
  • 27
  • A Windows service has specific requirements, see http://stackoverflow.com/questions/68113/how-to-create-a-windows-service-from-java-app – PeterJ Dec 13 '12 at 06:13

1 Answers1

4

You cannot just assign any arbitrary .exe file as-is to run as a service. There are specific API functions involved that services must use to interact with the Service Control Manager (SCM). That is why you are getting the errors - those .exe files are not using those APIs to interact with the SCM.

If you are not writing code specifically for SCM interaction (Java does not support creating Windows services), then all is not lost. In some situations (Chrome NOT being one of them!), you can use a separate wrapper to host non-service apps and handle the SCM interactions on their behalf:

Service wrapper

For Java apps, there are a few wrapper projects available:

Java Service Wrapper

Yet Another Java Service Wrapper

ow2

Remy Lebeau
  • 454,445
  • 28
  • 366
  • 620