|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.Launcher
This class launches files in their associated applications and opens urls in the default browser for different operating systems. This really only works meaningfully for the Mac and Windows.
Acknowledgement goes to Eric Albert for demonstrating the general technique for loading the MRJ classes in his frequently-used "BrowserLauncher" code.
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
Method Summary | |
static int |
launchFile(java.io.File file)
Launches the file whose abstract path is specified in the File parameter. |
static int |
openURL(java.lang.String url)
Opens the specified url in a browser. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static int openURL(java.lang.String url) throws java.io.IOException
A browser will only be opened if the underlying operating system recognizes the url as one that should be opened in a browser, namely a url that ends in .htm or .html.
url
- The url to open
java.io.IOException
- if the url cannot be loaded do to an IO problempublic static int launchFile(java.io.File file) throws java.io.IOException, java.lang.SecurityException
java.io.IOException
- if the file cannot be launched do to an IO problem
java.lang.SecurityException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |