• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

open Browser from java application

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,

I am new to Java, and I hope you can answer my stupid question. I want to open a browser with URL specified from a Java application window(GUI with JFC/Swing). How can I implement that ? e.g There is a JButton @ the GUI form, and once I click the button, then the IE will be opened and forward to the site that I specified @ the GUI form.

Please help me out

Myraid Thanks

Transistor
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the java.lang.Runtime class. But keep in mind that not everyone uses (or even has) Microsoft IE.
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm... Apparently, Java 6 will introduce a new Desktop API that will launch the default browser or email client. (Nice!)

In the meantime, I just found this code for a decent platform-independent approach. I haven't tried it myself, so let us know how this works if you use it.

(PS: I found these by searching on "java default browser".)
[ May 21, 2006: Message edited by: marc weber ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class Marc mentioned could be combined with this one to get something decent, I think.
reply
    Bookmark Topic Watch Topic
  • New Topic