This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Can anybody out there tell me how to open URL in new browser window from java application? I am using Runtime.getRuntime().exec with rundll32 but this opens a URL in existing window. Thanks Medha Kamat
You'll probably find it a lot easier to open a new window on the client side of things (IE use HTML to do it instead of your app) In the A HREF link, add the param TARGET="_blank" and that will open a new window, and have the HREF point to the servlet or whichever you wanted in a new window.
Joined: Aug 22, 2002
Joined: Feb 15, 2003
I think this is an IE issue (i'm assuming you're using IE). Open IE, tools->internet options->advanced tab under the browsing category, uncheck the box that says "reuse windows for launching shortcuts" , and then try your program again.
When you exec to RunDLL32 with an HTML file argument, it works exactly as if you had clicked on the file in Windows Explorer, or even typed the name in a command window. URL arguments work the same way. You could instead exec the Internet Explorer executable which should always open a new browser. Mine is at "C:\Program Files\Internet Explorer\IEXPLORE.EXE" Add the URL as an argument (I think). This is trickier if you want it to run on other people's PCs - they may have different versions of IE in different locations, or Netscape or Opera or some other browser. Can you get the default browser from the registry and exec that?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi