1
// CLASSIFICATION: UNCLASSIFIED
6
* Created on June 14, 2001, 9:02 AM
9
package geotrans3.utility;
12
import geotrans3.misc.StringHandler;
20
public class StartBrowser extends Object {
22
/** Creates new StartBrowser */
23
public StartBrowser() {
26
// The url must start with either "http://" or
29
public static void displayURL(java.awt.Component parent, String url)
31
boolean windows = isWindowsPlatform();
32
String browserCommand = null;
33
StringHandler stringHandler = new StringHandler();
38
// browserCommand = 'rundll32 url.dll,FileProtocolHandler http://...'
39
browserCommand = WIN_PATH + " " + WIN_FLAG + " " + url;
40
Process process = Runtime.getRuntime().exec(browserCommand);
44
// browserCommand = 'netscape http://www.javaworld.com'
45
browserCommand = UNIX_PATH + " " + url;
46
Process process = Runtime.getRuntime().exec(browserCommand);
49
catch(java.io.IOException x)
51
// couldn't start browser
52
stringHandler.displayErrorMsg(parent, "Could not invoke browser, command=" + browserCommand);
56
//Determine if operating system is windows
57
public static boolean isWindowsPlatform()
59
String os = System.getProperty("os.name");
61
if ( os != null && os.startsWith(WIN_ID))
67
// Used to identify the windows platform.
68
private static final String WIN_ID = "Windows";
70
// Default browser under windows.
71
private static final String WIN_PATH = "rundll32";
73
// Flag to display a url.
74
private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
76
// Default browser under unix.
77
private static final String UNIX_PATH = "netscape";
81
// CLASSIFICATION: UNCLASSIFIED