• Post Reply Bookmark Topic Watch Topic
  • New Topic

Open a Browser

 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
how can i open up a browser from java? i wanna use a JButton so that when a user clicks on that button, it pops up the default browser to a certain site specified in that button
thanks
rock
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no generic way to launch the "default browser" in Java across platforms. However, in windows, if you enter the URL on the command line (you can do this in Java using Runtime.exec(...)), windows will launch the URL in the default browser.
 
Ted Reynolds
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also somebody out there that has done a lot of the work for doing this already. Check out http://browserlauncher.sourceforge.net/
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The browserlauncher Ted mntioned is definitely the way to go. I use it in all my apps
Brian
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!