title: How to kill a java process by name in python?
body: <p>I am trying to kill java process with name "MyClass" using below python script :</p>
  
  <pre><code>import os
  os.system("kill $(ps aux | grep 'MyClass' | grep -v 'grep' | awk '{print $2}')")
  </code></pre>
  
  <p>But this gives me output as below and the process is still running</p>
  
  <pre><code>sh: 1: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
  kill -l [exitstatus]
  512
  </code></pre>
  
  <p>I know that the $ sign is the problem here but do not know how to make this work.</p>
  
  <p>Any help/hint is appreciated.
  Thanks.</p>