open browser with site in java code example
Example: how to open a webpage with java
/**
* author Scratchy (Twitter @S_cratchy)
* Just import stuff
*/
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
This you put in your button or whatever
*/
String url_open ="HTTPS://www.google.com";
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url_open));
} catch (IOException ex) {
Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
}