Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows running application list using Java

Tags:

windows

How to get Windows running application list using Java?I got to get the processlist.

like image 866
Palani Avatar asked Dec 12 '25 01:12

Palani


1 Answers

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...

like image 184
Philippe Avatar answered Dec 13 '25 21:12

Philippe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!