public class ProcessUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static OS |
getOS()
Retrieves the type of operating system.
|
static int |
getPID(java.lang.Process process)
Gets the operating system's process id of the given process.
|
static java.lang.Process |
getProcessListProcess()
Gets the OS process for the process list.
|
static java.util.Collection<ProcessInfo> |
getRunningJavaProcesses()
Gets a list of running java processes.
|
static void |
killProcess(int pid)
Kills the process with the given process id.
|
static void |
killProcess(java.lang.Process process)
Kills the provided process with a operating system's kill command.
|
public static OS getOS()
public static java.lang.Process getProcessListProcess()
throws java.io.IOException
java.io.IOException - Thrown if a problem occurred while trying to access the process list process.public static java.util.Collection<ProcessInfo> getRunningJavaProcesses() throws java.io.IOException
java.io.IOException - Throwsn if there was an issue accessing the OS's process list.public static int getPID(java.lang.Process process)
process - The process for which the process id shall be looked up.public static void killProcess(int pid)
throws java.io.IOException
pid - The id of the process which is to be killed.java.io.IOException - Thrown if the system command could not be issued.public static void killProcess(java.lang.Process process)
throws java.io.IOException
process - The process to be killed.java.io.IOException - Thrown if the system command could not be issued.