How to get Windows running application list using Java?I got to get the processlist.
A:
you can search SO for similar answers. one here. See if it fits your needs. Else, there are many solutions on the net as well. search google for them
ghostdog74
2010-02-05 09:14:26
A:
You can run some command line util from Java for collecting processes information. For example:
Process process = Runtime.getRuntime().exec("qprocess");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
Then you just read its output and parse it. qprocess
is a standard Windows XP utility. In other versions of Windows you probably need some other utility.
Rorick
2010-02-05 09:24:26
+1
A:
I would recommend also using the qprocess utility, then, if you need more info about a process, use wmic.
Example :
String line;
try {
Process proc = Runtime.getRuntime().exec("wmic.exe");
BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
OutputStreamWriter oStream = new OutputStreamWriter(proc.getOutputStream());
oStream .write("process where name='explorer.exe'");
oStream .flush();
oStream .close();
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
See http://ss64.com/nt/wmic.html or http://support.microsoft.com/servicedesks/webcasts/wc072402/listofsampleusage.asp for some example of what you can get from wmic...
Philippe
2010-02-05 10:31:42