title: Running Maven from Java code in Windows?
body: <p>I am trying to run maven from my java class based on this suggestion:</p>
  
  <p><a href="https://stackoverflow.com/questions/5141788/how-to-run-maven-from-java">How to run maven from java?</a></p>
  
  <pre><code>Runtime.getRuntime().exec("mvn");
  </code></pre>
  
  <p>but I get:</p>
  
  <pre><code>java.io.IOException: Cannot run program "mvn": CreateProcess error=2, The system cannot find the file specified
  </code></pre>
  
  <p>mvn is on my path and I can run it just fine from cmd:</p>
  
  <pre><code>C:\Users\m&gt;mvn -v
  Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
  Maven home: C:\apache-maven-3.0.3\bin\..
  Java version: 1.6.0_20, vendor: Sun Microsystems Inc.
  Java home: C:\Program Files\Java\jdk1.6.0_20\jre
  ...
  </code></pre>
  
  <p>any suggestions?</p>