we\'re writing an open-source jdbc driver for bigquery, and ran into the following problem:
We want to authorize our driver with Oauth 2 as an installed application.
Basically sounds good but here is another way if you want to open using specific browser (if more than one browser in the system)
String url = "http:/devmain.blogspot.com/";
String[] browsers = { "firefox", "opera", "mozilla", "netscape" }; // common browser names
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0)
browser = browsers[count]; // have found a browser
Runtime.getRuntime().exec(new String[] { browser, url }) // open using a browser
More details here: http://devmain.blogspot.com/2013/10/java-how-to-open-url-in-browser.html