|
From: Andreas W. <and...@em...> - 2004-05-12 07:43:52
|
<html><style>p {margin: 0px}</style><body lang=3DEN-US link=3Dblue vlink=3Dpurpl=
e><P>Dan,</P><P>as I wrote in my previous e-mail, I would not recommend to=
do this in Java. And I also pointed to two alternatives on how to do=
it:</P><FONT size=3D2><P>> I would not recommend doing platform-specific=
stuff with Java. This <BR>> normally leads to more problems than you m=
ight want to solve since it <BR>> is most likely that things work compl=
etely different on different systems.<BR>> But if you are forced t=
o do this stuff, you may either call the Windows <BR>> net tool (a=
s you already mentioned) or write a JNI library that makes <BR>> calls =
into the Windows Service API (see the Wrapper's C methods <BR>> wrapper=
StartService() and wrapperStopService() in wrapper=5Fwin.c).</P></FONT><P>Th=
e Wrapper's Java API does not provide methods to access services (except f=
or controlling the application it is starting) because this is not way it =
is designed to work.</P><P>I also think it does not make any sense to impl=
ement this task in Java, since you do not have any benefit writing the app=
lication in a platform-independant manner when you are trying to do only p=
latform-specific stuff.</P><P>Cheers,<BR>Andreas</P><TABLE id=3Dalt style=3D"P=
ADDING-LEFT: 10px; MARGIN-LEFT: 20px; BORDER-LEFT: blue 2px solid"><TBODY>=
<TR><TD><DIV class=3DSection1><P class=3DMsoNormal><FONT face=3DArial size=3D2><SP=
AN>I have been tasked with writing an application which is capable of star=
ting and stopping a windows service. The application is supposed to =
be written in Java. I was planning on using the Service Wrapper to i=
nstall and run the service.</SPAN></FONT></P><P class=3DMsoNormal><FONT face=
=3DArial size=3D2><SPAN></SPAN></FONT> </P><P class=3DMsoNormal><FONT face=3D=
Arial size=3D2><SPAN> &=
nbsp; When browsing the API I didn=92t see any mechanism to access the=
services, and start/stop a particular service. Can anyone tell me i=
f this is possible, and perhaps point me in the write direction=3F</SPAN></F=
ONT></P><P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN></SPAN></FONT>&nb=
sp;</P><P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN>Thanks,</SPAN></FO=
NT></P><P class=3DMsoNormal><FONT face=3DArial size=3D2><SPAN>Dan</SPAN></FONT><=
/P></DIV></TD></TR></TBODY></TABLE><BR><BR><BR></body></html>
|