Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Killing a java.lang.Process and its children

Avatar of tikiliainen
tikiliainen asked on
18 Comments1 Solution6446 ViewsLast Modified:
This is a general question about java.lang.Process and the semantics of java.lang.Process.destroy( ) - particularly under *nix (Solaris + Linux). Windows-related knowledge is also welcome but I am primarily concerned about the signals sent to the process when destroy( ) is called.

I have done a relatively quick google on the matter but could not find what the signal sent to the process is -- so I assume it's SIGTERM (and not SIGKILL). Is there a way to specify a signal that I want, or is this not in the standard Java distribution because this is platform-dependent? Anyone who could point answer this and point me to an "official" resource where this is described stands a good chance of getting the points :-)

However, for complete glory, I would also like to know how to kill (i.e. the equivalent of "kill -9" -- sending SIGKILL) a process spawned from a Java program _and_ all of its children. I am not sure whether sending SIGKILL also ensures that all the child processes will die too. I would like to avoid having to shell out to a script that would ps or pstree the situation, perform some awking and then kill -9 the children. Is there a way to kill the children, do I need to do it or does this happen automatically?

Avatar of timbauer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answers