Hello!

Chrome browser starts a new process for each tab. Every tab named as "chrome.exe" on windows and on linux "chromium-browse". For example: http://www.ghacks.net/wp-content/uploads/2011/01/sys_manage.png

I need to list all tab title names of opened processes. Is there any function which gets title (or name or summary or ...) of a external process?

Thank you!

Recommended Answers

All 4 Replies

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.