Problem when waiting for a process to terminate

H

Håvard Kverneland

First of all, I've tried to search through groups.google.com for
answers, though unsuccessfully.

I'm trying to launch a browser process and wait for that process to
terminate before continuing execution.

String url = "http://www.microsoft.com"
String cmd = "c:\\program files\\internet explorer\\iexplore.exe " +
url;
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();

The code above works fine. Execution stops at p.waitFor() until the IE
window has been closed.

However, I'd like to start the OS registered browser automatically by
using

String cmd = "rundll32 url.dll,FileProtocolHandler" + url

instead. If I try that, p.waitFor() returns immediately. I guess
because the IE process is spawned by the run process or something like
that.

How can I launch an URL without specifying the IE path directly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top