Java.lang.ProcessBuilder Class

Java.lang.ProcessBuilder Class

Introduction

The java.lang.ProcessBuilder class is used to create operating system processes.This class is not synchronized.

Class declaration

Following is the declaration for java.lang.ProcessBuilder class:

public final class ProcessBuilder
   extends Object

Class constructors

S.N.Constructor & Description
1ProcessBuilder(List<String> command)

This constructs a process builder with the specified operating system program and arguments.

2ProcessBuilder(String… command)

This constructs a process builder with the specified operating system program and arguments.

Class methods

S.N.Method & Description
1List<String> command()

This method returns this process builder’s operating system program and arguments.

2ProcessBuilder command(List<String> command)

This method sets this process builder’s operating system program and arguments.

3ProcessBuilder command(String… command)

This method sets this process builder’s operating system program and arguments.

4File directory()

This method returns this process builder’s working directory.

5ProcessBuilder directory(File directory)

This method sets this process builder’s working directory.

6Map<String,String> environment()

This method returns a string map view of this process builder’s environment.

7boolean redirectErrorStream()

This method tells whether this process builder merges standard error and standard output.

8ProcessBuilder redirectErrorStream(boolean redirectErrorStream)

This method sets this process builder’s redirectErrorStream property.

9Process start()

This method starts a new process using the attributes of this process builder.

Methods inherited

This class inherits methods from the following classes:

  • java.lang.Object

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.