Programming Code Examples

How to Use ProcessBuilder To Make System Calls In Java1 min read

Java Code:

The ProcessBuilder class is used to create operating system processes.

In java we use two classes, the Runtime class and the Process class. Exec method of the Runtime class to run the command as a separate process. Invoking the exec method returns a Process object for managing the subprocess. getInputStream() and getErrorStream() are the two methods of the Process object to read the normal output of the command, and the error output of the command.

Add comment