permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes opening browser from swing. is it possible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "opening browser from swing. is it possible" Watch "opening browser from swing. is it possible" New topic
Author

opening browser from swing. is it possible

vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
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.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38042
    
  22
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.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2154
    
    7
JDK6 introduced the Desktop class to open the default application for any given file.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
BareBonesBrowserLaunch is a very good way to get this done in a cross-platform, non-Java-6-dependent way.


Ping & DNS - my free Android networking tools app
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38042
    
  22
That sounds a better idea.
vikas sharmaa
Ranch Hand

Joined: Jun 28, 2007
Posts: 191
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: opening browser from swing. is it possible
 
Similar Threads
How to open a pdf file from Swing Panel?
How to get open or save dialog in struts.
Opening Browser Window
Possible to use applet from swing app?
Open New Window