title: Why ulimit returns different results through java Runtime.exec()
body: <p>why the 'ulimit -a' returns differently through Runtime.exec() from running it straight under bash, thanks for any pointers.</p>
  
  <p>Java: 
  open files (-n) 65536</p>
  
  <p>bash-3.00$ ulimit -a:
  open files (-n) 256</p>
  
  <pre><code>public class TestUlimit {
      public TestUlimit() throws IOException, InterruptedException {
              Runtime runTime = Runtime.getRuntime();
              Process p = runTime.exec(new String[] { "bash", "-c", "ulimit -a" });
              InputStream in = p.getInputStream();
              InputStreamReader isr = new InputStreamReader(in);
              BufferedReader br = new BufferedReader(isr);
              String line = null;
              System.out.println("Result of Process p = runTime.exec(new String[]     { \"bash\", \"-c\", \"ulimit -a\" });");
              while ((line = br.readLine()) != null) {
                      System.out.println(line);
              }
              p.waitFor();
  
              p = runTime.exec("ulimit -a");
              in = p.getInputStream();
              isr = new InputStreamReader(in);
              br = new BufferedReader(isr);
              System.out.println("Result of p = runTime.exec(\"ulimit -a\");");
              while ((line = br.readLine()) != null) {
                      System.out.println(line);
              }
              p.waitFor();
      }
  </code></pre>