How to get opened applications list in windows(taskmanager ->application) using java code?

Viewed 3798

Here is the snapshot what I want exately!

Windows Application Task List

I am trying to develop a program in java which can get all opened application in the taskbar. I have tried many links but none of those are helpful to me. The same question was also asked by Ganesh Rangarajan in July 2013 but none has answered him. Here is his question.

4 Answers

"tasklist.exe /nh /v" worked perfectly to get the running applications.

    try {
            Process p = Runtime.getRuntime().exec("tasklist.exe /nh /v");
            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
            while ((String line = input.readLine()) != null) {
                System.out.println(line); //<-- Parse data here.
            }
            input.close();
        } catch (Exception err) {
            err.printStackTrace();
        }
Related