This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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

open Browser from java application

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class Marc mentioned could be combined with this one to get something decent, I think.
    Bookmark Topic Watch Topic
  • New Topic