• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

opening browser from swing. is it possible

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to open browser from the java stand alone application using swing or any other api? I am trying to make a button or hyperlink on my screen. on click of the button a browser should open with a url mentioned in the code. please help.
 
Marshal
Posts: 70211
280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried Runtime.getRuntime().exec()?

But don't go anywhere near that method until you have studied the ProcessBuilder class and (much more important) Michael Daconta's classic article When Runtime.exec() won't.
 
Rancher
Posts: 3204
29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDK6 introduced the Desktop class to open the default application for any given file.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BareBonesBrowserLaunch is a very good way to get this done in a cross-platform, non-Java-6-dependent way.
 
Campbell Ritchie
Marshal
Posts: 70211
280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds a better idea.
 
vikas sharmaa
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much Campbell, Ulf, and Rob. i will look into the ways you suggested me. and get back to you, if got struck.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic