title: Java :Kill process runned by Runtime.getRuntime().exec()
body: <p>I need to write a code,that </p>
  
  <ol>
  <li>run unix process with <code>Runtime.getRuntime().exec("java -jar MyServerRunner -port MYPORT");</code></li>
  <li>find PID of the process by executing command from java code <code>lsof -t -i: MYPORT</code></li>
  <li>and kill him by pid <code>kill -9 PID</code> ( also by executing command from java code)</li>
  <li>and then execute others commands</li>
  </ol>
  
  <p>BUT </p>
  
  <p>if I execute this command by <code>Runtime.getRuntime().exec()</code> my program exits with exit code 137 - this means that when I run <code>Runtime.getRuntime().exec("kill -9 PID")</code> I kill process of  My java programm, but not the program, that I run from code.</p>
  
  <p>How can I kill ONLY the process that I run from code ?</p>
  
  <p>P.S. maybe I should use ProcessBuilder ?</p>