Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check to see if another instance of IE is already open

Status
Not open for further replies.

bobrivers2003

Technical User
Oct 28, 2005
96
GB
I have a simple JFrame that includes a button that when pressed calls a method that opens Internet Explorer with a given url. It is possible to check if IE is already open and if so stops a new browser window from opening?

void openIE()
{
try {
Runtime rt = Runtime.getRuntime();
rt.exec("C:\\Program Files\\Internet
Explorer\\IEXPLORE.EXE
} catch (Exception z){
System.out.println(z);
}

}

Thanks and Regards
 
Assuming you're using windows, you can access the process list with tasklist command and check wether a instance of IEXPLORE.EXE is running.


Cheers,
Dian
 
To be exact, the command would be

Code:
tasklist /fi "imagename eq IEXPLORE.EXE"

but you will need to check the output.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top