Hello Supriya

 

To my knowledge there is no way of killing a process by ID from Java - it's
not available as part of the API. Perhaps Sun have done this deliberately as
it's a potential security risk - that would make sense.

 

A cleaner way to kill off a process is to get it to shut itself down by
issuing a command remotely. You could start a JMX container inside the JVM
you launch and then issue a shutdown command to it. This is how JBoss can be
shut down, for example. It's very easy to set this sort of thing up using
the Spring framework. The only drawback to this is that you'll need a unique
port per process and technically anyone who connects to your server could
shut it down - it's a security hazard. Again Spring has lots of facilities
in it to secure and authenticate your connection should you want to do this
to production quality.

 

In our system we basically have a peer server which all of the other servers
register with by name. If you want to shut a server down you run a client
which logs on to the peer and then tells the server via the peer to shut
down.

Tim Gordon
Allustra Limited
Paxton House
30 Artillery Lane
London
E1 7LS
Tel +44 (0)20 7539 5722
Fax +44 (0)20 7539 5732
http://www.allustra.com/

  _____  

From: supriya sharma [mailto:[EMAIL PROTECTED] 
Sent: 27 February 2007 10:40
To: [EMAIL PROTECTED]
Subject: Getting the process id of a process started by ANT

 

Hi Tim,

 

I found an issue raised by you in Apache Ant forum which states that :

 

"I've written an ANT script which launches some processes - is there a
platform-independent way to get the process id of those processes as they're
launched - I need a way of killing them off ."

 

Even I am having the same issue. I am starting certain executables from Ant
but dont know how to kill them after the task is over.

 

I thought may be you have got the answer to my query.It will be really nice
of you if you can help.

 

Thanks

Supriya

 Send instant messages to your online friends http://uk.messenger.yahoo.com 

Reply via email to