title: How does java execute terminal commands?
body: <p>Found this to be tricky; Having the following code:</p>
  
  <pre><code>String cmd = "find /home/folder/ -type f"; 
  Runtime run = Runtime.getRuntime() ; 
  Process pr = run.exec(cmd); 
  pr.waitFor();
  </code></pre>
  
  <p>I'll <code>pr.getInputStream()</code> and have the proper <code>find</code> result there, no problem. However, if I want to be a bit more specific and have my command as <code>cmd = "find /home/folder/ -type f -name somefile*";</code>, the input stream will be empty.</p>
  
  <p>Now, I thought it would be something related to the string expansions done by the interactive shell (which wouldn't be used in this case, I suppose). In this case the <code>*</code> would have no meaning, and <code>find</code> would be looking for files really named "*" (something like <code>\*</code>). So I've tried to have my command as <code>sh -c "find /home/folder/ -type f -name somefile*"</code>. But it didn't work either...</p>
  
  <p>What am I missing?</p>
  
  <p>thanks,</p>
  
  <p>f.</p>
  
  <p>Ps.: It is an AIX box, with IBM's Java JVM.</p>