Is it possible to destroy process tree in Java?

I am creating a process using Runtime.exec(). Newly created process spawns another process and that may spawn other processes. I want to kill all these child processes when my application exits.
Process.destroy() only kills the immediate child.
Is it possible in Java to kill process tree? or is there any other way of achieving it?
Thanks
Sudhan.

Depending on your operating system, create a shell script file that will call the other processes. Create another shell script file that will kill the processes created. Use Runtime.exec() to call each shell script. Not exactly 100% portable, but you are using Runtime.exec() anyway.
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • Is it possible for a process to participate in two separate clusters

    Is it possible for a process to participate in two separate clusters? For example if our application would like to get market data in one cluster that has a separate multicast address, and post order in another.

    The easiest way for a client to access multiple clusters is via Coherence*Extend:
         http://wiki.tangosol.com/display/COH33UG/Configuring+and+Using+Coherence*Extend
         The client would not be a member of the cluster, instead it would connect to the cluster via a proxy node that is in the cluster. Using <remote-cache-scheme>, you can configure a cache to point to one proxy (in cluster A) and have another cache point to another proxy (in cluster B.)
         Thanks,
         Patrick Peralta

  • Is it possible to run process chain from the certain process/point?

    Hello
    Is it possible to run process chain from the certain process?
    How?
    Thanks

    Hello,
    yes it possible! use the following steps.
    1. Goto the process which you want the chain to start from.Goto display messages>> Chain tab. In the generated instance note the variant and instance.
    2. Goto table RSPROCESSLOG and give variant and instance and get logid details.
    3. t codese37>> run FM RSPROCESSFINISH.
    4. give the deatils u have got in RSPROCESSLOG table here and say execute.
    This will solve ur problem.
    Hope this helps!
    Reg
    Deepmala

  • Is it possible to create a tree with drag-and-drop functionality using ajax

    I saw these samples;
    Scott Spendolini's AJAX Select List Demo
    http://htmldb.oracle.com/pls/otn/f?p=33867:1:10730556242433798443
    Building an Ajax Memory Tree by Scott Spendolini
    http://www.oracle.com/technology/pub/articles/spendolini-tree.html
    Carl Backstrom ApEx-AJAX & DHTML examples;
    http://htmldb.oracle.com/pls/otn/f?p=11933:5:8901671725714285254
    Do you think is it possible to create a tree with drag-and-drop functionality using ajax and apex like this sample; http://www.scbr.com/docs/products/dhtmlxTree/
    Thank you,
    Kind regards.
    Tonguç

    Hello,
    Sure you can build it, I just don't think anyone has, you could also use their solution as well in an APEX page it's just a matter of integration.
    Carl

  • Is it possible to create hierarchical tree report (not group tree) CR2008?

    Hi,
    Is it possible to create hierarchical tree kind report using CR 2008(no group tree in the report)?  The report somewhat look like below and a node can have multiple Child and so and so. Is there any magical way either as a chart or any object which supports the below structure.
                                                          Parent1
                                           Child1              Child2             Child3             Child4          Child5
                     Child1A     Child1B      Child1C
        Child1Aa  Child1Ab
    its hierarchical tree  structure and it should be in detail section of the report so that print in paper is possible.
    Please help first of all, can we able to create a report in above structure(each item needs to be surronuded with box and the each last child will contain a table valued data.
    (if I post this thread, it may look like plain text, please consider the above data as a hierarchical tree  structure with child having N number of children)
    Thanks

    Moved from .NET Development - Crystal Reports forum to Crystal Reports Design forum.
    Ludek

  • Flex 4, is it possible to populate a tree component with sqlite table data?

    is it possible to populate a tree component with sqlite table data?
    If it is, how would I go about doing this?
    Thanks
    Kristin

    Hi Mustafa,
    it is true, the function can return component as type. This is more for the scenario, when you want to recognize some component based on some checks, eg.
    if(something)
    return CHECKBOX_1;
    else
    return CHECKBOX_2;
    so, the use case exists for sure. But of course the application itself is static.
    where do you see a scenario for dynamic creation of components?
    The only one component which can instantiate new components is the SplitCellContainer, and this is restricted to the drag&drop action from Fragment Bookmark Gallery. And this is again restricted to containers, as Fragment can hold containers as parent component. Of course the container content will be created/instantiated as well (I have coded example with ComponentManager in the Community SDK: Second Functional Application with SDK Components (Online Composition v.2) blog).
    As far I know there is no function in SplitCellContainer which would "simulate" the drop of a Fragment today (perhaps worth an Idea on this?). Having that - the scenario would be possible. Today, this can be made partly - but the user would need to drag&drop a prepared fragment with the component.
    Anyway, the problems will start after the creation - then it would be require to have also functions to re-position the new created component in some other container - this would be complex probably.
    Karol

  • My phone got stolen, is it possible to destroy the device?

    My phone got stolen, is it possible to destroy the device?

    pearlielie wrote:
    My phone got stolen, is it possible to destroy the device?
    You mean with the special self-destruct option?

  • I lost my ipad? Is it possible to destroy it?

    I lost my Ipad. Is it possible to destroy it? I mean, is it possible to unable someone to re-use it?
    Best Regards!

    No.
    What To Do If Your iDevice Is Lost Or Stolen
    If you activated Find My Phone before it was lost or stolen, you can track it only if Wi-Fi is enabled on the device. What you cannot do is track your device using a serial number or other identifying number. You cannot expect Apple or anyone else to find your device for you. You cannot recover your loss unless you insure your device for such loss. It is not covered by your warranty.
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should have done in advance - before you lost it or it was stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in delta Chelsea hotel downtown an I am not able to track it. Please help!, has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
      8. Report Stolen iPad | Stolen Lost Found Online
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • It is possible to destroy (kill) an applet?

    Hi, everybody
    It is possible to destroy (kill) an applet like a Frame, as using something like:
    public boolean handleEvent ( Event e){ 
    if (e.id == Event.WINDOW_DESTROY)
    System.exit( 0 );
    I know that this method is used on Frame, to destroy it. Can I use something similar in an applet?

    Here is the only reference in the search data on site here, for "Applet Destroy".
    http://java.sun.com/javaone/sessions/slides/TT09/views10.htm
    Do you mean to end the Applet? as in ending a program?
    Or to get rid of the Applet as in Delete it?
    Sincerely Shadow Cat

  • Populate Flex Tree from Java Code (Database)

    Hi
    Can someone please help me? I'm very new to using flex. I'm
    basically trying to create a tree that is populated from data in my
    database. I am using hibernate to fetch that data.
    The plan is to basically create the tree in Java code (since
    I don't want any processing done on the client PC) and then pass
    this to the flex tree (or an actionscript data structure that is
    compatible as the tree datasource)
    I am creating the java tree using DocumentImpl. Is this
    correct? What class would work?
    Element e = null;
    Node n = null;
    Document xmldoc= new DocumentImpl();
    Element root = xmldoc.createElement("USERS");

    quote:
    Originally posted by:
    ntsiii
    Stop running and get a map (read the documents)
    This is hardly a useful comment and must discourage new users
    from asking questions. If you think the documentation relating to
    the use of the tree control is straightforward then I beg to
    differ.
    If you are aware of a clear example of how to use the data
    tree with a php backend returning a remote data object please
    enlighten me. Meanwhile I continue my search but not within the
    livedocs.
    One site I have found that may be of use is
    http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
    Not everyone is an expert.

  • Implementation of LISP trees in Java

    I have a problem with implementation of a something similar to a LISP tree in Java. That means that I want to be able to combine different if-else-conditions from a set of variables and operators and run it. For example, if (variable) (operator) (variable) (operator2) (variable) (operator) (variable)
    whereby :
    variable: means a variable
    operator: <, >, =, +, _,
    variable: variable
    operator2: &&, ||, etc
    I don't know how to do in a way that a variable can be picked up from a set, operator can be picked up from a set and operator2 can also be picked up from a set.

    Lisp doesn't use trees... it uses lists. In fact, Lisp stands for "List Processing".
    Take a look at the java.util.LinkedList class. If you make a LinkedList of Nodes, where each Node contains an Object car and LinkedList cdr, you've got yourself a Lisp list implementation!

  • How to list all OS processes from a java program

    I want to list/kill all OS processes from a java program, or a part from all processes according to a filter on a name of process.
    a similar functionality is ps in Unix or taskkill in Windows XP.
    Thanks!

    Hi,
    I was looking for such lib, but finally I decided to accomplish the job with my fingers end ;-). It maigh be helful for u guys:
    // is written for x based OSs
    private static void killProcess(Process process) {
    if (process == null)
    return;
    process.destroy();
    private static void closeProcessStreams(Process process) {
    try {
    process.getErrorStream().close();
    } catch (IOException eyeOhEx) {
    private static void listPHPs() {
    Process proc = null;
    Runtime rt = Runtime.getRuntime();
    int exitVal = 0;
    try {     
    proc = rt.exec(" ps -C php"); // here use ur filter. issue "man ps" in linux for more info
    catch (Exception ex) {
    System.out.println(ex.getMessage());
    killProcess(proc);
    return;
    try {
    // process the return list of ur command
    InputStream stdReturnStr = proc.getInputStream();
    InputStreamReader isr = new InputStreamReader(stdReturnStr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    String returnMsg = "";
    boolean firstLine = true;
    int[] allPIDs = new int[100]; // finally we have an array of PIDs
    int PIDCount = 0;
    while ( (line = br.readLine()) != null) {
    if (!firstLine){ // the first line is title, ignore it
    returnMsg += line + "\n";
    String PID = line.trim().split(" ")[0];
    System.out.println(PID);
    try{
    allPIDs[PIDCount] = Integer.parseInt(PID);
    PIDCount++;
    }catch(Exception ex){           
    else
    firstLine = false;
    System.out.println(returnMsg);
    catch (Exception t) {
    System.out.println(t.getMessage());
    killProcess(proc);
    return;
    try {
    exitVal = proc.waitFor();
    catch (Exception t) {
    System.out.println(t.getMessage());
    killProcess(proc);
    return;
    closeProcessStreams(proc);
    Thats it!

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

  • Is it possible to call VB dll in Java

    Is it possible to call VB dll in Java?
    If yes then How?

    If you mean VB6 than you can call VB Module like a COM object with any Java-COM bridge.
    VB.NET could be called with my Object-Oriented JNI for .NET 1.1/2.0:
    http://www.simtel.net/product.php[id]95126[SiteID]simtel.net
    http://www.simtel.net/product.php[id]98653[SiteID]simtel.net

  • Class Not found Exception for invoking BPEL process through the Java code

    Hi.
    The JDeveloper IDE raise the Exception From the invoking the BPEL process through the java code .Class Not Found Exception (Locator,ID.......).What is process of importing these classes from API.

    In your code (.bpel file) import the library using the bpelx:exec tag. For example the adding the following entry in your .bpel file imports the com.oracle.bpel.client.util library.
    <bpelx:exec import="com.oracle.bpel.client.util.*"/>

Maybe you are looking for

  • Trouble importing old photo library to iPhoto 06

    I just updated to iLife/iPhoto 06. When importing old photo library which is 7-8,000 photos, I got 24,000 + images incl. images of computer icons, demo photos, images that look like pieces from web pages (headers, part of photos etc), 4-5 copies of m

  • CSCut90579 - Workflow imports fails with missing mappings for custom inputs

    Hello Team, Do we know if this bug is also present in UCS-D 5.3 release? Is the fix planned to be integrated in 5.2(0.3) release? Thank you

  • MRP for alternative items

    Dears, We have requirement from client that , they need to plan alternative items for their spare parts,  scenario is as follows. Header Mat is X  and  Components are   C and D,  here C and D are alternative to each other. If we run out of stock for

  • IPod not remembering playback position

    hi all. i have converted many movies files into the mp4 for my 5g 30gb ipod (mainly from .avi files already converted from DVD's) and my ipod wont remember the playback position. if i watch a movie, stop, auto-sync my ipod with itunes, the position i

  • Moving 10GB Quicktimes from Mac to Windows.

    Any suggestions on how to move very large Quicktimes between non-networked Macs and Windows 7 PCs? Is the file limit still 4GB for FAT32 disks?