title: Running a jar file (within a loop) in a script with redirected output
body: <p>I'm trying to run a jar file multiple times (in a loop) and redirect its output to a file (using the append >> operator). I'm running, and must keep using, Windows 7. I tried doing this in a windows batch file and ran into the problem below so I installed Cygwin to make use of the bash script. My script is below:</p>
  
  <pre><code>for i in {1..10..1}
    do
      echo "Run $i"
      java -jar myjar.jar -cl &gt;&gt; runresults.txt
      echo "Sleeping..."
      sleep 60
      echo "Awake!"
  done
  </code></pre>
  
  <p>The problem: The script (Windows batch or Cygwin bash) runs only some iterations before hanging up (usually never more than 3). There's no error given. I added the sleep command to ensure that the prior iteration had time to release any locks prior to any attempt to make the next run. I've increased the sleep time to 200+ seconds and the behavior is still the same. Can anyone help me out on this?</p>