title: "The handle is invalid" when running .net console via java
body: <p>I'm trying to run dot net console application via Java:</p>
  
  <pre><code>process = Runtime.getRuntime().exec(commandLine);
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>Detecting
  The handle is invalid.
  </code></pre>
  
  <p>when running it directly via the console (windows) there is no problem:</p>
  
  <pre><code>Detecting
  100%
  Done.
  100%
  </code></pre>
  
  <p>I'm running more applications in this form but have no problem .</p>
  
  <p>Got this stack trace:</p>
  
  <pre><code>Detecting at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean&amp; succeeded)
   at System.Console.get_CursorTop()
   at AutomaticImageOrientation.HelperClasses.General.WriteProgressToConsole(Int32 lastIndex, Int32 totalImages)
   at AutomaticImageOrientation.MainManager.DetectImage(String[] files, String outputPath, String&amp; globalErrorMessage, Dictionary`2&amp; foundRotations)
  </code></pre>
  
  <p>The problem is when the .net app trying to write to the console What is the solution?</p>
  
  <p>found the line that cause the problem:</p>
  
  <pre><code>Console.CursorLeft = 0;
  </code></pre>
  
  <p>Do you know why?</p>