This is in the context of a local Processing program. I would like to run an external program to get some data. Is there a popen() or equivalent function I can use?
Process process = Runtime.getRuntime().exec("your command");
Then you can read and write the data using the Process
streams.
JDK5 introduced ProcessBuilder for more control over the process generation.
Process process = new ProcessBuilder(command).start()
Be aware of the fact, that internally forkAndExec is invoked, and fork 'makes a copy of the entire parents address space', so that even a little command can lead to OutOfMemoryErrors, when the parent process has big amount of memory space acquired.
see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With