• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in getting the link to open in Internet explorer

 
Archana Venu Aradhyula
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have a label. I have written mouse listeners for this link. That is when i click on this link www.google.com has to be opened in Internet Explorer.

I need some suggestions or code templates.
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you explicitly want IE then you can execute "cmd /c start iexplore http://www.google.com". This will flash a command window for an instance though, but it will work regardless of where IE is installed. Usually that is in C:\Program Files\Internet Explorer but it can be different.

If you want to use the default browser (which I would prefer personally), you can execute "rundll32 url.dll,FileProtocolHandler http://www.google.com".

Check out Runtime.exec or ProcessBuilder on how to execute external programs. And once you've done that, search for the JavaWorld article "When Runtime.exec() won't".
 
satya satish
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please try with this
i hope , this opens in a default browser.(if it is a InternetExplorer)
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That only works in SWT. If you are using Swing or AWT that won't work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!