The example of this article tells the way Java calls the browser to open the webpage. Share it for everyone for your reference. The specific implementation method is as follows:
package com.yifang.Demo; Import Java.io.File; Public Class OpenPageDemo {Public Static Void Main (String [] ARGS) {Try {// string url = "http:// w ww.baidu.com "; string url = "//www.vevb.com/"; java.net.uri uri = java.net.uri.create (url); // Get the current system desktop expansion java.awt.desktop dp = java.Awt.Desktop. GetDesktop (); // Judging whether the system desktop supports the function IF (DP.Issupported (java.AWT.Desktop.ACTION.BROWSE)) {// File File = New File ("D: //aa.txt" ) ;/dp.edits (File) ;// Edit file dp.browse (uri); // Get the default browser of the system to open the link // dp.open (file); // Open the file in the default method // dp .print (file); // Print files with a printer}} catch (java.lang.nullpoIntterexception E) {// This is the URI throwing abnormality when it is empty e.printstacktrace (); ) {// This is the default browser of the system that cannot be obtained.It is hoped that this article is helpful to everyone's Java program design.