File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open Browser from java application

 
YuenLian Wu
Ranch Hand
Posts: 73
  • 0
  • 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
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • 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
Java Mac Safari
  • 0
  • 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 ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic