Monday, February 28, 2011

How to open an external URL with default browse in Java


try {                                                             
  URI uri = new URI("http://www.google.lk"); //This line may throw
                                               URISyntaxException 
  Desktop desktop = Desktop.getDesktop();
  desktop.browse(uri); //This line may throw URISyntaxException
} catch (URISyntaxException e) {

} catch (IOException e) {

}


No comments:

Post a Comment