1 56 package org.objectstyle.cayenne.modeler.util; 57 58 import java.io.IOException ; 59 60 import org.apache.log4j.Logger; 61 62 63 70 public class BrowserControl { 71 private static Logger logObj = Logger.getLogger(BrowserControl.class); 72 73 private static final String WIN_ID = "Windows"; 75 private static final String WIN_PATH = "rundll32"; 77 private static final String WIN_FLAG = "url.dll,FileProtocolHandler"; 79 84 85 92 public static void displayURL(String url) { 93 boolean windows = isWindowsPlatform(); 94 String cmd = null; 95 try { 96 if (windows) { 97 cmd = WIN_PATH + " " + WIN_FLAG + " " + url; 99 Runtime.getRuntime().exec(cmd); 100 } else { 101 123 } 124 } catch (IOException ex) { 125 logObj.debug("Could not invoke browser, command=" + cmd, ex); 127 } 128 } 129 135 public static boolean isWindowsPlatform() { 136 String os = System.getProperty("os.name"); 137 if (os != null && os.startsWith(WIN_ID)) 138 return true; 139 else 140 return false; 141 142 } 143 } 144 | Popular Tags |