title: Error: Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified. Applies for all executables
body: <p>My goal is to run SVN commands from java for one of my requirements, for the same i have already installed TortoiseSVN command line tool. Added the appropriate path"C:/Program Files"/TortoiseSVN/bin" to my environment "Path" variable.</p>
  
  <p>With the above setup, i can run my svn commands from windows command line using say "svn --version" and it works perfectly fine.</p>
  
  <p>Now coming back to the code to execute the same, i am using processbuilder for this. However i end up with the above error - java.io.IOException: Cannot run program "svn --version": CreateProcess error=2, The system cannot find the file specified.</p>
  
  <p>I tried following things already,</p>
  
  <ol>
  <li><p>Using ProcessBuilder.environment checked the Path and PATH values. Path is emply, but PATH has all the necessary application paths configured including "TortoiseSVN/bin" path. So that clears the theory of ProcessBuilder not have executable location in its path.</p></li>
  <li><p>While executing, instead of just svn --version i tried giving the complete path i.e. "C:/Program Files/TortoiseSVN/bin/svn.exe". That too gave the same error.</p></li>
  <li><p>I tried the same code for other executable like "java -version" that too failed with the same exception.</p></li>
  </ol>
  
  <p>I now have a feeling something very basic is not right. But tried hitting my head around this for more than a day now, but i ain't getting any clues.</p>
  
  <p>Ok one more thing, i am running this on Windows 7 box.</p>
  
  <p>Below is the code that i am using,</p>
  
  <pre><code>    import java.io.BufferedReader;
      import java.io.ByteArrayOutputStream;
      import java.io.IOException;
      import java.io.InputStreamReader;
  
      public class RunningExecutable {
  
  public static void main(String[] args){
      String command = "svn --version";
  
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      try {           
          ProcessBuilder svnProcessBuilder = new ProcessBuilder(command);
          String PATH = svnProcessBuilder.environment().get("PATH");
          System.out.println("PATH - " + PATH);
  
          String path = svnProcessBuilder.environment().get("Path");
          System.out.println("Path - " + path);
  
          Process procObject = svnProcessBuilder.start();
  
          BufferedReader cmdStreamReader = new BufferedReader(new InputStreamReader(procObject.getInputStream()));
          String cmdOutput;
          while ((cmdOutput = cmdStreamReader.readLine()) != null) {
              outputStream.write((cmdOutput + "\n").getBytes());
          }
          System.out.println("O/p - " + outputStream.toString());
      } catch (IOException e) {
          e.printStackTrace();
      } catch (Throwable th) {
          th.printStackTrace();
      }
  }
      }
  </code></pre>
  
  <p>Looking forward to any hints/pointers at all.</p>
  
  <p>Thanks,
  Vicky</p>