New
#1
Unable to start .jar file as a window service
Hello Everyone,
This is my 1st thread, so i'm naive about the categories under which the issue i'm facing falls. I've a jar file which contains a very simple program of displaying "Hello" message in the console.I've pasted the code at the end of this thread.I want to run this jar file as a windows service.This service gets started without any hiccup,However,It simply wouldn't start the service.
I've tried running this service as using NET and Sc command.But in vain.Below is the error i'm facing
C:\Windows\system32>sc start MajaService
[SC] StartService FAILED with error 193.
Further, as a workaround I created a .bat file for executing this .jar file and again tried creating a window service for this .bat file,In this event i get the followingh error:
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
and below is my program:
-----------------------------------------------------------------------------------
import java.io.*;
class Hello implements Runnable
{
Thread thread;
Hello()
{
thread = new Thread(this, "Hello1");
thread.start();
}
public void run()
{
try
{
while(true)
{
System.out.println("Hello");
Thread.sleep(500);
}
}
catch(Exception e){}
}
public static void main(String[] args)
{
Hello h = new Hello();
}
}
---------------------
any Sort of Help is appreciated.
Regards,
Supriya