This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
sannuth kashikar wrote:What is the use of java.lang.Process class.How useful is this ?
It's part of Java's machinery for launching other programs. It's useful to the extent that you ... need to launch other programs!
You don't create Process objects yourself. If you launch a program with the Runtime.exec() methods, or the ProcessBuilder class, then you will get a Process object that you can use to keep track of the running program.
A Process object is good for only a few things:
- interaction with the process using the input, output and error streams
- terminating the process
- waiting for the process to finish before doing anything else
- retrieving the exit code of the process
That's why there are only methods for these operations.