I am currently developing a Java system that communicates with node.js using socket.io. The system and the script are on the same server. How can I execute the script from my Java code and keep it alive from my app?
Say you have a node.js script named "mynodejs.js". You can use the following java code:
Process p = Runtime.getRuntime().exec("node mynodejs.js");
or
ProcessBuilder b = new ProcessBuilder("node mynodejs.js", "-args");
Have a look at ProcessBuilder class.
You can start any process on your machine like you would via shell, if I understand your question correctly.