Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2010
    Rep Power

    Exclamation Need help in quitting a unix process from java after a certain time

    Hi All ,

    I am executing a shell script through java .

    Runtime run=Runtime.getRuntime();
    Process proc=run.exec("/root/umdhanas/New/");

    Now my requirement is i need to monitor from my java program as if the script execution takes more than 2 mins, i should kill that process from my java program. Not sure as how it can be done. Please help me on this.

  2. #2
    xerberuz is offline Member
    Join Date
    Apr 2010
    Rep Power


    Use the ProcessBuilder instead of the runtime call.

    ProcessBuilder (Java 2 Platform SE 5.0)

    Edit: You can use the Process object to terminate the sup-process.
    Last edited by xerberuz; 11-09-2010 at 01:47 PM.

Similar Threads

  1. Replies: 3
    Last Post: 08-23-2011, 01:46 PM
  2. Run Unix commands from Java
    By yahyaaa in forum New To Java
    Replies: 13
    Last Post: 06-18-2010, 12:50 AM
  3. Need help with Process execution time display
    By murali18 in forum New To Java
    Replies: 5
    Last Post: 03-19-2010, 12:19 AM
  4. using java to login to unix
    By dowell in forum Advanced Java
    Replies: 4
    Last Post: 05-23-2008, 08:26 AM
  5. How can I set a time out on the loading process
    By paul in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 05:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts