title: Get java version number from python
body: <p>I need to get the java version number, for example "1.5", from python (or bash). </p>
  
  <p>I would use:</p>
  
  <pre><code>os.system('java -version 2&gt;&amp;1 | grep "java version" | cut -d "\\\"" -f 2')
  </code></pre>
  
  <p>But that returns 1.5.0_30</p>
  
  <p>It needs to be compatible if the number changes to "1.10" for example.</p>
  
  <p>I would like to use cut or grep or even sed.
  It should be in one line.</p>