There is no platform independent way to do this. You could use Runtime to run an OS specific utility to gather this information. Getting OS information is very easy. I would suggest checking the different system properties you can access.

OK. I will research for OS depended libaries but i could not understand exactly what you mean with "You could use Runtime to run an OS specific utility to gather this information.".

Can you please tell me if process stores any title or summary or something.

Edited 4 Years Ago by free_dom: n/a

OK. I will research for OS depended libaries but i could not understand exactly what you mean with "You could use Runtime to run an OS specific utility to gather this information.".

Can you please tell me if process stores any title or summary or something.

here is a small quick runtime example thats specific to windows:

import java.io.*;  
public class TestExec {  
    public static void main(String[] args) {  
        try {  
            Process p = Runtime.getRuntime().exec("cmd /C dir");  
            BufferedReader in = new BufferedReader(  
                                new InputStreamReader(p.getInputStream()));  
            String line = null;  
            while ((line = in.readLine()) != null) {  
                System.out.println(line);  
            }  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  
}

if you're still wondering why its specific to windows well does unix/linux have command prompt(cmd.exe)? :). As for getting the title of a process is really simple, but its only going to show Chrome.exe and its location, it will be unable to give you a summary /name on the tab opened within the process??? This could though be done in another language such as c/c++/c# but thats a whole other chapter. So for java unless using JNI all you can do for now is get listed processes etc anything command prompt can do you can :P

Hope that helps

This should work on Linux distros.

I can find the window-id with xprop command by grapping a window. Also xprop show me the proces-id too. But it shows me the root process. For example chromium browser open a new process for each tab. When i grab a tab, it shows me the title of tab but always the same proces-id. I need to egt the child process id.

This article has been dead for over six months. Start a new discussion instead.