• Post Reply Bookmark Topic Watch Topic
  • New Topic

pulling up default web browser on mult. plateforms  RSS feed

 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking to open a local file in the default web browser launched by a swing button. Unfortunately I also need to make this work across platforms. I haven't been able to turn up much on google other then the browserlauncher project on sourceforge but that appears to be defunct. If anyone could point me in the right direction or offer a code sample I would me most appreciative!

thanks much!
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

You may have a look at the JDIC Packages. A more pragmatic alternative could be this java tip.

Hope that helps,
 
James Carman
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're launching your application via Java WebStart, check out the javax.jnlp.BasicService.showDocument( URL ) method.
 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks much for the replies! This will be launched locally by the jvm. I'll check out those links - appreciate it
 
c moses
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lionel Badiou:
Hello,

You may have a look at the JDIC Packages. A more pragmatic alternative could be this java tip.

Hope that helps,


Lionel - any idea of the class listed at javaworld also works for opening local files in the browser? (haven't run into this in java but have had problems elsewhere with that differentiation causing things to not work)..
thanks!

---never mind, noticed the comment in the code that indicated opening a local file--- thanks!
[ March 07, 2005: Message edited by: c moses ]
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again,

Concerning the java tip link I have provided, this line of code opens a local html page with the default browser:


Note that UNIX/MAC parts of the code are hardly flexible (assuming netscape as the default browser).

I guess that Windows version would be:


Note again that the Windows command used there ('rundll32 url.dll,FileProtocolHandler ...') actually opens the default opening program attached to a file (in this case the default browser is called hence your file is a .html file).

Hope that helps,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!