public class JProcesses extends Object
JProcesses allows to interact with system processes. It is possible to list all alive processes, kill them or change the priority.
| Modifier and Type | Method and Description |
|---|---|
static JProcessesResponse |
changePriority(int pid,
int newPriority)
Static method that changes the priority of a process
If the process does not finish with this method, try with the stronger killProcess() For further details see ProcessInfo |
JProcesses |
fastMode()
Enables the fast mode.
|
JProcesses |
fastMode(boolean enabled)
Enables/disables the fast mode.
|
static JProcesses |
get()
Gets the JProcesses instance.
|
static ProcessInfo |
getProcess(int pid)
Static method that returns the information of a process
Some information is retrieved: PID Name Used memory Date/time Priority [...] |
static List<ProcessInfo> |
getProcessList()
Convenience static method that returns the list of processes
that match with the provided name.
|
static List<ProcessInfo> |
getProcessList(String name)
Convenience static method that returns the list of processes
that match with the provided name.
|
static JProcessesResponse |
killProcess(int pid)
Static method that kills a process abruptly (forced mode)
For further details see ProcessInfo |
static JProcessesResponse |
killProcessGracefully(int pid)
Static method that kills a process, letting it the necessary time to finish
If the process does not finish with this method, try with the stronger killProcess() For further details see ProcessInfo |
List<ProcessInfo> |
listProcesses()
Return the list of processes running in the system.
|
List<ProcessInfo> |
listProcesses(String name)
Return the list of processes that match with the provided name.
|
public static JProcesses get()
public JProcesses fastMode()
public JProcesses fastMode(boolean enabled)
enabled - boolean true or falsepublic List<ProcessInfo> listProcesses()
For further details see ProcessInfo
public List<ProcessInfo> listProcesses(String name)
For further details see ProcessInfo
name - The name of the searched processpublic static List<ProcessInfo> getProcessList()
For further details see ProcessInfo
public static List<ProcessInfo> getProcessList(String name)
For further details see ProcessInfo
name - The name of the searched processpublic static ProcessInfo getProcess(int pid)
For further details see ProcessInfo
pid - The PID of the searched processJProcesses object with the information of the processpublic static JProcessesResponse killProcess(int pid)
ProcessInfopid - The PID of the process to killJProcessesResponse response object that contains information about the result of the operationpublic static JProcessesResponse killProcessGracefully(int pid)
For further details see ProcessInfo
pid - The PID of the process to killJProcessesResponse response object that contains information about the result of the operationpublic static JProcessesResponse changePriority(int pid, int newPriority)
For further details see ProcessInfo
pid - the PID of the process tochange prioritynewPriority - integer with the new version. For windows you can use the helper constants at WindowsPriorityJProcessesResponse response object that contains information about the result of the operationCopyright © 2017. All rights reserved.