|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.huguesjohnson.LaunchBrowser
public abstract class LaunchBrowser
LaunchBrowser attempts to launch the operating system default browser.
Usage examples:
String result=(new LaunchBrowser()).launch("http://www.huguesjohnson.com");
String verboseResult=(new LaunchBrowser()).launch("http://www.huguesjohnson.com",true);
String verboseResult=(new LaunchBrowser()).launch("file://c:\\some-folder\\some-file.html",true);
String verboseResult=(new LaunchBrowser()).launch("file:///some-dir/some-file.html",true);
This has only been tested on Windows 2000, if it doesn't work on another OS please set verbose to true to debug. I can just about guarantee this will not work with OS/2, the algorithm to lookup the operating system explicitly checks for Windows and MacOS with the default being UNIX/Linux. UNIX/Linux is considered the default because each "flavor" of UNIX/Linux returns a different name to the System.getProperty("os.name") call.. there is no standard name. For example, HP-UX returns "HP-UX" while Solaris returns "Solaris".
Updated 2007-07-28: Updated UNIX/Linux code with logic from BareBonesBrowserLaunch.java By Dem Pilafian (see http://www.centerkey.com/java/browser/). The Windows and MacOS logic was basically the same between the original version of this class and BareBonesBrowserLaunch.java but his UNIX/Linux logic was more reliable.
| Constructor Summary | |
|---|---|
LaunchBrowser()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
launch(java.lang.String url)
Launches a web browser with the specified url. |
static java.lang.String |
launch(java.lang.String url,
boolean verbose)
Launches a web browser with the specified url. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LaunchBrowser()
| Method Detail |
|---|
public static java.lang.String launch(java.lang.String url)
url - The address to open.
public static java.lang.String launch(java.lang.String url,
boolean verbose)
url - The address to open.verbose - Whether or not to return verbose output, useful for debugging. This is false if launch(url) is used.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||