This plugin implements the File/Import/URL command and the commands in the Help menu that
open web pages. It is based on Eric Albert's cross-platform (Windows, Mac OS X and Unix)
BrowserLauncher class.
BrowserLauncher is a class that provides one static method, openURL, which opens the default
web browser for the current user of the system to the given URL. It may support other
protocols depending on the system -- mailto, ftp, etc. -- but that has not been rigorously
tested and is not guaranteed to work.
Yes, this is platform-specific code, and yes, it may rely on classes on certain platforms
that are not part of the standard JDK. What we're trying to do, though, is to take something
that's frequently desirable but inherently platform-specific -- opening a default browser --
and allow programmers (you, for example) to do so without worrying about dropping into native
code or doing anything else similarly evil.
Anyway, this code is completely in Java and will run on all JDK 1.1-compliant systems without
modification or a need for additional libraries. All classes that are required on certain
platforms to allow this to run are dynamically loaded at runtime via reflection and, if not
found, will not cause this to do anything other than returning an error when opening the
browser.
This code is Copyright 1999-2001 by Eric Albert (ejalbert@cs.stanford.edu) and may be
redistributed or modified in any form without restrictions as long as the portion of this
comment from this paragraph through the end of the comment is not removed. The author
requests that he be notified of any application, applet, or other binary that makes use of
this code, but that's more out of curiosity than anything and is not required. This software
includes no warranty. The author is not repsonsible for any loss of data or functionality
or any adverse or unexpected effects of using this software.
Credits:
Steven Spencer, JavaWorld magazine (Java Tip 66)
Thanks also to Ron B. Yeh, Eric Shapiro, Ben Engber, Paul Teitlebaum, Andrea Cantatore,
Larry Barowski, Trevor Bedzek, Frank Miedrich, and Ron Rabakukk