@Test public void testGetProcessListByName() { System.out .println("===============Testing getProcessList by name============"); String processToSearch = "java"; if (OSDetector.isWindows()) { processToSearch += ".exe"; } List<ProcessInfo> processesList = JProcesses .getProcessList(processToSearch); assertTrue(processesList != null && processesList.size() > 0); for (final ProcessInfo processInfo : processesList) { System.out.println("Process PID: " + processInfo.getPid()); System.out.println("Process Name: " + processInfo.getName()); System.out.println("Process Time: " + processInfo.getTime()); System.out.println("User: " + processInfo.getUser()); System.out.println("Virtual Memory: " + processInfo.getVirtualMemory()); System.out.println("Physical Memory: " + processInfo.getPhysicalMemory()); System.out.println("CPU usage: " + processInfo.getCpuUsage()); System.out.println("Start Time: " + processInfo.getStartTime()); System.out.println("Priority: " + processInfo.getPriority()); System.out.println("Command: " + processInfo.getCommand()); System.out.println("------------------"); } List<ProcessInfo> processesListFull = JProcesses.getProcessList(); List<ProcessInfo> processesListFound = new ArrayList<ProcessInfo>(); for (final ProcessInfo process : processesListFull) { if (processToSearch.equals(process.getName())) { processesListFound.add(process); } } assertTrue( "Manually list differs from search founded " + processesListFound.size() + " instead of " + processesList.size(), processesList.size() == processesListFound.size()); System.out .println("===============End test getProcessList by name============"); }
public static List<ProcessInfo> getProcessList() { return getService().getList(); }
JProcesses { public static List<ProcessInfo> getProcessList() { return getService().getList(); } }
JProcesses { public static List<ProcessInfo> getProcessList() { return getService().getList(); } private  JProcesses(); }
JProcesses { public static List<ProcessInfo> getProcessList() { return getService().getList(); } private  JProcesses(); static JProcesses get(); JProcesses fastMode(); JProcesses fastMode(boolean enabled); List<ProcessInfo> listProcesses(); List<ProcessInfo> listProcesses(String processName); static List<ProcessInfo> getProcessList(); static List<ProcessInfo> getProcessList(String processName); static ProcessInfo getProcess(int pid); static JProcessesResponse killProcess(int pid); static JProcessesResponse killProcessGracefully(int pid); static JProcessesResponse changePriority(int pid, int newPriority); }
JProcesses { public static List<ProcessInfo> getProcessList() { return getService().getList(); } private  JProcesses(); static JProcesses get(); JProcesses fastMode(); JProcesses fastMode(boolean enabled); List<ProcessInfo> listProcesses(); List<ProcessInfo> listProcesses(String processName); static List<ProcessInfo> getProcessList(); static List<ProcessInfo> getProcessList(String processName); static ProcessInfo getProcess(int pid); static JProcessesResponse killProcess(int pid); static JProcessesResponse killProcessGracefully(int pid); static JProcessesResponse changePriority(int pid, int newPriority);  }