The Artima Developer Community
Sponsored Link

Java Answers Forum
Browser Opening

1 reply on 1 page. Most recent reply: Oct 9, 2003 5:57 AM by mausam

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
sabab

Posts: 34
Nickname: sabab
Registered: Aug, 2003

Browser Opening Posted: Oct 8, 2003 8:52 AM
Reply to this message Reply
Advertisement
Hai all

I am using the following code to open a browser from my java application

try {
Runtime RTime = Runtime.getRuntime();
Process Proc = RTime.exec("cmd /c start iexplore Mysite.com");
} catch(Exception E) {
System.out.println("Error");

OK,my problem is the above code will open the site in IE only, i want to open the page in any browser(Default browser) supported by the system, what should i do for this (The broswer can be IE/Netscape/Opera etc)

pls help


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: Browser Opening Posted: Oct 9, 2003 5:57 AM
Reply to this message Reply
Strange..isnt it??

You are using start iexplorer and expect the default browser to open... :)

use
String url = "http://www.aminur4u.tripod.com";
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);


this will run fine for windows....

Now what abt other OS??

check the site

http://www.javaworld.com/javaworld/javatips/jw-javatip66.html

Flat View: This topic has 1 reply on 1 page
Topic: j2ee Previous Topic   Next Topic Topic: Read from a file in same directory

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use