NativeIntegration
, Process
public class WrapperProcess extends Object implements Process
Process
implementation that wraps another to add thread-safety and to update the JVM's internal view of
various process properties.Constructor | Description |
---|---|
WrapperProcess(Process process,
boolean windows) |
Modifier and Type | Method | Description |
---|---|---|
void |
detach() |
Detaches this process from the parent to ignore ctrl-c.
|
String |
getEnvironmentVariable(String name) |
Get the value of an environment variable.
|
int |
getProcessId() |
Returns the process identifier.
|
File |
getWorkingDirectory() |
Returns the process' current working directory.
|
void |
setEnvironmentVariable(String name,
String value) |
Sets the value of an environment variable.
|
void |
setWorkingDirectory(File directory) |
Sets the process' working directory.
|
String |
toString() |
public WrapperProcess(Process process, boolean windows)
public int getProcessId() throws NativeException
Process
getProcessId
in interface Process
NativeException
- On failure.public void detach() throws NativeException
Process
detach
in interface Process
NativeException
- On failure.public File getWorkingDirectory() throws NativeException
Process
getWorkingDirectory
in interface Process
NativeException
- On failure.public void setWorkingDirectory(File directory) throws NativeException
Process
setWorkingDirectory
in interface Process
NativeException
- On failure.public String getEnvironmentVariable(String name) throws NativeException
Process
getEnvironmentVariable
in interface Process
NativeException
- On failure.public void setEnvironmentVariable(String name, String value) throws NativeException
Process
setEnvironmentVariable
in interface Process
value
- the new value. Use null or an empty string to remove the environment variable. Note that on some
platforms it is not possible to remove the environment variable safely. On such platforms, the value is set to an
empty string instead.NativeException
- On failure.