When reading and writing to a child process, it is necessary to execute the read and write blocks in separate threads to avoid deadlock.
In the previous part of this Java Process Guide, we looked at how to read from and write to a child process. While executing the read and write blocks in a single thread works for simple cases, we should run these in separate threads to avoid deadlocks.
Continue reading “Java Process Example Part 2”
Startup a native process from Java using Runtime. Read the output from the process and write some data to it. After you are done, terminate the process.
Have you ever run into a situation where you need to execute an OS command from inside java and read its output? You can use the Process class to do so, but there are some caveats to consider.
Continue reading “Java Process Example”