title: Node.js run a java program?
body: <p>I have a simple nodejs server up and running. I am running into trouble when I try to spawn a child process. the jar file I am trying to access, is in the same directory as the node script. It takes in a command line argument that I am trying to pass in and it outputs data to the command line, which I am trying to pipe into the var child.</p>
  
  <pre><code>var child = require('child_process').spawn('java -jar done.jar',['argument to pass in']);
  
  child.stdout.on('data', function(data) {
      console.log(data.toString());
  });
  
  child.stderr.on("data", function (data) {
      console.log(data.toString());
  });
  </code></pre>
  
  <p>This produces the following error message:</p>
  
  <pre><code>events.js:85
        throw er; // Unhandled 'error' event
              ^
  Error: spawn java -jar done.jar ENOENT
      at exports._errnoException (util.js:746:11)
      at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
      at child_process.js:1137:20
      at process._tickCallback (node.js:355:11)
  </code></pre>
  
  <p>Any ideas?</p>