Menu

#255 Controlling the services via .java

v3.3.5
open
nobody
None
5
2012-12-11
2009-08-06
No

Hi All,

Can you please tell me, how can i start, pause, resume and stop via my application.
Basically i have 4 buttons for todo this. Here is my methods,

public void Start()
{
try
{
Runtime.getRuntime().exec("D:/Wrapper Windows-x86-32-3.3.5/bin/Start.bat");
}
catch (Exception ex)
{
System.out.println("Error :" + ex.getMessage());
}
}

public void Pause()
{
try
{
Runtime.getRuntime().exec("D:/Installables/Wrapper Windows-x86-32-3.3.5/bin/Pause.bat");
}
catch (Exception ex)
{
System.out.println("Error :" + ex.getMessage());
}
}

public void Resume()
{
try
{
Runtime.getRuntime().exec("D:/Installables/Wrapper Windows-x86-32-3.3.5/bin/Resume.bat");
}
catch (Exception ex)
{
System.out.println("Error :" + ex.getMessage());
}
}

public void Stop()
{
try
{
Runtime.getRuntime().exec("D:/Installables/Wrapper Windows-x86-32-3.3.5/bin/Stop.bat");
}
catch (Exception ex)
{
System.out.println("Error :" + ex.getMessage());
}
}

With this i can able to control the service. Instead of calling the batch files, can you please tell me, how can i control the wrapper service via WrapperManager or WropperListner.

I can try this. But i didn't understand.
String[] args = null;
WrapperManager.start(new WrapperListener()
{
public Integer start(String[] arg0)
{
//Calling the wrapper.exe
return null;
}

public int stop(int arg0)
{
return -1;
}

public void controlEvent(int arg0)
{

}
}, args);

Can some one please explain this flow.

Discussion


Log in to post a comment.