Skip to content

Instantly share code, notes, and snippets.

@michalkowol
Created January 10, 2015 11:39
Show Gist options
  • Select an option

  • Save michalkowol/6af94c7dedf123df0596 to your computer and use it in GitHub Desktop.

Select an option

Save michalkowol/6af94c7dedf123df0596 to your computer and use it in GitHub Desktop.
if(java.awt.Desktop.isDesktopSupported) {
val desktop = java.awt.Desktop.getDesktop
if(desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
new Thread(new Runnable { def run() {
try {
val waitTimeBeforeLaunchingBrowser = 3000 // give web server some time to start up
Thread.sleep(waitTimeBeforeLaunchingBrowser)
desktop.browse(new java.net.URI(browserUiUrl_IpAddress))
} catch {
case t: Throwable => if (verbose) System.err.println("warning: failed to open browser (for convenience only)")
}
} }).start()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment