title: Gracefuly stop .net initiated Java Process
body: <p>Having the next .net code, I want to stop it correctly so that the jvm executes it's ShutdownHooks.</p>
  
  <pre><code>System.Diagnostics.Process p = new Process();
  p.StartInfo.UseShellExecute = false;
  p.StartInfo.RedirectStandardError = true;
  p.StartInfo.RedirectStandardOutput = true;
  p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
  p.StartInfo.WorkingDirectory = @"C:\test\";
  p.StartInfo.FileName = @"C:\Program Files\Java\jre6u16\bin\java.exe";
  p.StartInfo.Arguments = "-jar TheExecutable.jar";
  </code></pre>
  
  <p>Trying to stop the process with p.Kill() will force the jvm to stop without sending the equivalent SIGTERM found in the unix kill comand. Or maeby I am doing something wrong because the java process does not get it's shutdown hooks executed. </p>
  
  <p>Thanks !</p>