* Opens a browser.
* @param url The url to open in the browser
* @return true only if the a browser was found and the startup was successful. False otherwise.
*/
public static boolean openBrowser(String url) {
SimpleLocalCommand command = null;
if (OsVersion.IS_OSX && OsVersion.IS_MAC) {
command = new SimpleLocalCommand("open " + url);
command.execute();
if (command.getExitValue() == 0) {
return true;
}
} else if (OsVersion.IS_WINDOWS) {
command = new SimpleLocalCommand("cmd /C start " + url);
command.execute();
if (command.getExitValue() == 0) {
return true;
}
} else {
String[] browsers = new String[]{"firefox", "opera", "mozilla", "netscape",
"htmlview", "xdg-open", "gnome-open", "kfmclient openURL", "call-browser",
"konqueror", "epiphany"};
for (String browser : browsers) {
command = new SimpleLocalCommand(3000, browser, url);
command.execute();
if (command.getExitValue() == 0) {
return true;
}
}
}