Nodejs Child Process: write to stdin from an already initialised process

You need to pass also \n symbol to get your command work: var spawn = require(‘child_process’).spawn, child = spawn(‘phantomjs’); child.stdin.setEncoding(‘utf-8’); child.stdout.pipe(process.stdout); child.stdin.write(“console.log(‘Hello from PhantomJS’)\n”); child.stdin.end(); /// this call seems necessary, at least with plain node.js executable

How do I launch a completely independent process from a Java program?

There is a parent child relation between your processes and you have to break that. For Windows you can try: Runtime.getRuntime().exec(“cmd /c start editor.exe”); For Linux the process seem to run detached anyway, no nohup necessary. I tried it with gvim, midori and acroread. import java.io.IOException; public class Exec { public static void main(String[] args) … Read more