title: Java - Runtime.exec() fails to run
body: <p>When i try to run any Runtime.exec() command like this simple one to print the java version:</p>
  
  <pre><code>String [] cmd = { "java", "-version" };
  Runtime runtime = Runtime.getRuntime();
  Process process = runtime.exec(cmd);
  
  BufferedReader stdError = new BufferedReader( new InputStreamReader( process.getErrorStream() ) );
  String s = null;
  
  while ( ( s = stdError.readLine() ) != null )
      System.out.println(s);
  </code></pre>
  
  <p>It works just fine, but if i am using a JRE bundled with my Java application i always get errors saying that java is unknown:</p>
  
  <pre><code>java.io.IOException: Cannot run program "java": error=2, No such file or directory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      at java.lang.Runtime.exec(Runtime.java:620)
      at java.lang.Runtime.exec(Runtime.java:450)
      at java.lang.Runtime.exec(Runtime.java:347)
      at org.runner.Runner.main(Runner.java:11)
  </code></pre>
  
  <p>Why does this happen when using a bundled JRE?</p>