共用方式為


ProcessBuilder.Start Method

Definition

Starts a new process using the attributes of this process builder.

[Android.Runtime.Register("start", "()Ljava/lang/Process;", "")]
public Java.Lang.Process? Start ();
[<Android.Runtime.Register("start", "()Ljava/lang/Process;", "")>]
member this.Start : unit -> Java.Lang.Process

Returns

a new Process object for managing the subprocess

Attributes

Exceptions

if any of the elements of Command() is null.

if an I/O error happens.

Remarks

Starts a new process using the attributes of this process builder.

The new process will invoke the command and arguments given by #command(), in a working directory as given by #directory(), with a process environment as given by #environment().

This method checks that the command is a valid operating system command. Which commands are valid is system-dependent, but at the very least the command must be a non-empty list of non-null strings.

A minimal set of system dependent environment variables may be required to start a process on some operating systems. As a result, the subprocess may inherit additional environment variable settings beyond those in the process builder's #environment().

If there is a security manager, its SecurityManager#checkExec checkExec method is called with the first component of this object's command array as its argument. This may result in a SecurityException being thrown.

Starting an operating system process is highly system-dependent. Among the many things that can go wrong are: <ul> <li>The operating system program file was not found. <li>Access to the program file was denied. <li>The working directory does not exist. </ul>

In such cases an exception will be thrown. The exact nature of the exception is system-dependent, but it will always be a subclass of IOException.

Subsequent modifications to this process builder will not affect the returned Process.

Java documentation for java.lang.ProcessBuilder.start().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to