title: Execute .bat file from Java, why Eclips project-directory matters?
body: <p>I want to execute a <code>.bat</code> file from a Java program.</p>
  <p>I declared the command for the <code>.bat</code> like:</p>
  <p><code>&quot;cmd.exe&quot;, &quot;/C&quot;, &quot;Start&quot;, &quot;C:\\File\\batfile.bat&quot;</code></p>
  <p>I use Windows XP and Eclipse Helios.</p>
  <h3>Code</h3>
  <pre><code>String cmd;
          try {
              String[] command = { &quot;cmd.exe&quot;, &quot;/C&quot;, &quot;Start&quot;, &quot;C:\\File\\batfile.bat&quot; };
                  Runtime r = Runtime.getRuntime();
                  Process p = r.exec(command);
                  p.waitFor();
  
                  } catch (Exception e) 
                  {
  
                  System.out.println(&quot;Execution error&quot;);} 
  </code></pre>
  <p>Why is it looking for my <code>.bat</code> file in the <strong>project directory</strong> of Eclipse?</p>