Example
import java.awt.Desktop;
import java.net.URI;
class BrowseURL
{
public static void main(String args[]) throws Exception
{
// Create Desktop object
Desktop d=Desktop.getDesktop();
// Browse a URL, say google.com
d.browse(new URI("http://google.com"));
}
}
Try it yourself! It works! The default handler for http:// protocol will be given the address to open.
No comments:
Post a Comment