title: How To Run Mac OS Terminal Commands From Java (Using Runtime?)
body: <p>I've been looking up ways to run external programs using Java's runtime. This works fine, for instance:</p>
  
  <pre><code>String[] cmd = {"mkdir", "test"};
  Runtime.getRuntime().exec(cmd);
  </code></pre>
  
  <p>Creates a new directory as you would expect. Now, from a bash window in Mac I can write this:</p>
  
  <pre><code>love testgame
  </code></pre>
  
  <p>To run the 'Love' game engine on a folder called testgame. Now, the reason this works is because I've aliased 'love' to call the love executable. I have a feeling that this is the reason that the following does <em>not</em> work:</p>
  
  <pre><code>String[] cmd = {"love", "/Users/mtc06/testgame"};
  Runtime.getRuntime().exec(cmd);
  </code></pre>
  
  <p>And nor does this (for those wondering):</p>
  
  <pre><code>String[] cmd = {"/bin/bash", "love", "/Users/mtc06/testgame"};
  Runtime.getRuntime().exec(cmd);
  </code></pre>
  
  <p>No doubt this is either some Java idiocy on my part, or some clash with the way that aliasing works. I hand it over to your venerable intellects, SO!</p>
  
  <p>UPDATE: this doesn't work either:</p>
  
  <pre><code>String[] cmd = {"/bin/sh", "/Applications/love", "/Users/michaelcook/Desktop/Playout"};
  Runtime.getRuntime().exec(cmd);
  </code></pre>
  
  <p>The error I'm receiving is 127 from the process generated by Runtime. I'm getting that as 'command not found' wherever I research it.</p>