Run another application from Java

It is possible in java to run another application by calling exec method on Runtime object or using process builder class. This tutorial illustrates three examples, first will open calculator application and will close it after three seconds. The second example will run another Java process and read the output and error streams from that process. The third example is doing the similar job but implemented using ProcessBuilder class.

Example 1

Example 2

Example 3

Reference :
Example three is taken from a book : “Operating System Concepts with Java”, Eight Edition