Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2004

Tip: Looking for answers? Try searching our database.

Limiting the number of browsers launched

Thread view: 
Hegemony Cricket - 20 Dec 2004 22:35 GMT
My application launches a web browser to view various files.  I use the
standard trick to launch them:

   Process p = Runtime.getRuntime().exec( new String[] { "command.com",
             "/c", "explorer", myfilename } );

I'm trying to limit the number of browsers launched at any one time to,
say, three.  I thought I could just keep a List of the Processes returned
from this call, and before I launched a new one, see if any of the previous
Processes have exited, and don't launch if there are more than three that
haven't.

Unfortunately, the process seems to have an exit value right away, once
the browser is launched successfully.  Is there any way to track the
actual browser process, and see if it is still running?

AdTHANKSvance,

--mark
Stanimir Stamenkov - 22 Dec 2004 16:51 GMT
[cross-posted to c.l.j.programmer, follow-up to c.l.j.programmer]

/Hegemony Cricket/:

> My application launches a web browser to view various files.  I use the
> standard trick to launch them:
>
>     Process p = Runtime.getRuntime().exec( new String[] { "command.com",
>               "/c", "explorer", myfilename } );

The above would fail on any WinNT (i.e. NT4/2000/XP and up) system.
On these systems there's no "command.com" but "cmd.exe". AFAIK the
preferred method to start the default registered browser on all
Windows systems is by invoking:

rundll32 url.dll,FileProtocolHandler <url>

Where you need to substitute the <url> in the above line with the
requested URL. Here's an article on this one:

"Control browsers from your Java application"
<http://www.javaworld.com/javaworld/javatips/jw-javatip66.html>

> I'm trying to limit the number of browsers launched at any one time to,
> say, three.  I thought I could just keep a List of the Processes returned
[quoted text clipped - 5 lines]
> the browser is launched successfully.  Is there any way to track the
> actual browser process, and see if it is still running?

The above may actually help solving this issue, I'm not sure though.

Signature

Stanimir



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.