Process Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The ProcessBuilder#start()
and
Runtime#exec(String[],String[],File) Runtime.exec
methods create a native process and return an instance of a
subclass of Process
that can be used to control the process
and obtain information about it.
[Android.Runtime.Register("java/lang/Process", DoNotGenerateAcw=true)]
public abstract class Process : Java.Lang.Object
[<Android.Runtime.Register("java/lang/Process", DoNotGenerateAcw=true)>]
type Process = class
inherit Object
- Inheritance
- Attributes
Remarks
The ProcessBuilder#start()
and Runtime#exec(String[],String[],File) Runtime.exec
methods create a native process and return an instance of a subclass of Process
that can be used to control the process and obtain information about it. The class Process
provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.
The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts.
By default, the created subprocess does not have its own terminal or console. All its standard I/O (i.e. stdin, stdout, stderr) operations will be redirected to the parent process, where they can be accessed via the streams obtained using the methods #getOutputStream()
, #getInputStream()
, and #getErrorStream()
. The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, or even deadlock.
Where desired, subprocess I/O can also be redirected using methods of the ProcessBuilder
class.
The subprocess is not killed when there are no more references to the Process
object, but rather the subprocess continues executing asynchronously.
There is no requirement that a process represented by a Process
object execute asynchronously or concurrently with respect to the Java process that owns the Process
object.
As of 1.5, ProcessBuilder#start()
is the preferred way to create a Process
.
Added in JDK1.0.
Java documentation for java.lang.Process
.
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.
Constructors
Process() | |
Process(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Properties
Class |
Returns the runtime class of this |
ErrorStream |
Returns an input stream that is connected to the error stream (stderr) of the native process represented by this object. |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
InputStream |
Returns an input stream that is connected to the standard output stream (stdout) of the native process represented by this object. |
IsAlive |
Tests whether the subprocess represented by this |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
OutputStream |
Returns an output stream that is connected to the standard input stream (stdin) of the native process represented by this object. |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Methods
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Destroy() |
Kills the subprocess. |
DestroyForcibly() |
Kills the subprocess. |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
ExitValue() |
Returns the exit value for the subprocess. |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
WaitFor() |
Causes the current thread to wait, if necessary, until the
process represented by this |
WaitFor(Int64, TimeUnit) |
Causes the current thread to wait, if necessary, until the
subprocess represented by this |
WaitForAsync() | |
WaitForAsync(Int64, TimeUnit) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |