title: Java Runtime Process Won't "Grep"
body: <p>I'm executing some commands from the command line in my java program, and it appears that it doesn't allow me to use "grep"? I've tested this by removing the "grep" portion and the command runs just fine! </p>
  
  <p>My code that DOESN'T work:</p>
  
  <pre><code>String serviceL = "someService";
  Runtime rt = Runtime.getRuntime();
  Process proc = rt.exec("chkconfig --list | grep " + serviceL);
  </code></pre>
  
  <p>Code that does work:</p>
  
  <pre><code>Runtime rt = Runtime.getRuntime();
  Process proc = rt.exec("chkconfig --list");
  </code></pre>
  
  <p>Why is this? And is there some sort of correct method or workaround? I'm aware that I could just parse the entire output, but I would find it easier to do it all from the command line. Thanks.</p>