title: Executing command line using "Runtime.getRuntime().exec()"
body: <p>I'm having a problem while executing a command line from Java code.<br>
  This is the code I use, and under the code are the errors I got.<br>
  I also tried using <code>ProcessBuilder</code> but I got the same errors.</p>
  
  <p>Ps: I am running the program on Windows.</p>
  
  <pre><code>public class Test {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      try {
          Process compilerProcess = Runtime.getRuntime().exec("clafer -k -m choco clafer.cfr);
  
          BufferedReader stdInput = new BufferedReader(new InputStreamReader(
                  compilerProcess.getInputStream()));
              String s = null;
              while ((s = stdInput.readLine()) != null) {
               System.out.print(s);        }  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
      // To have access to the text generated by the compiler.
  
  
  }
  
  }
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>java.io.IOException: Cannot run program "echo": CreateProcess error=2, the 
    specified file is not found
  at java.lang.ProcessBuilder.start(Unknown Source)
  at java.lang.Runtime.exec(Unknown Source)
  at java.lang.Runtime.exec(Unknown Source)
  at java.lang.Runtime.exec(Unknown Source)
  at eqe.Test.main(Test.java:12)
  Caused by: java.io.IOException: CreateProcess error=2, the specified file 
  is not found
  at java.lang.ProcessImpl.create(Native Method)
  at java.lang.ProcessImpl.&lt;init&gt;(Unknown Source)
  at java.lang.ProcessImpl.start(Unknown Source)
  ... 5 more
  </code></pre>