title: Java Runtime.getRuntime().exec() fails after calling it several hundred times
body: <p>I have a Java program that executes
  Runtime.getRuntime().exec("ls -l");
  many times, once for each directory in the system.</p>
  
  <p>My test system has more than 1,000 directories and Runtime.getRuntime().exec("ls -l"); seems to error out after 480 directories or so.
  The error message I'm getting is is "Error running exec(). Command: [ls, -l] Working Directory: null Environment: null".
  I'm guessing it's running out of some required system resources or is it?
  Is there any way to process all directories without erroring out?</p>
  
  <p>Relative comment from an answer:</p>
  
  <blockquote>
    <p>I should clarify that I was using Android SDK's adb.exe. I wanted to
    execute something like Runtime.getRuntime().exec("adb shell ls -l")
    multiple times on different directories.</p>
  </blockquote>