java 通过浏览器来访问指定的网站


通过浏览器来访问指定的网站

import java.io.IOException;

public class TestRuntime {

 private Runtime run ;
 
 public void init(){
  run = Runtime.getRuntime();
  try {
   run.exec("C:/Program Files/Internet Explorer/iexplore.exe http://www.baidu.com");
  } catch (IOException e) {
   e.printStackTrace();
  }
 }
 
 public static void main(String[] args){
  TestRuntime test = new TestRuntime();
  test.init();
 }
}

这个在网上找的,在本地还没有实验成功

Joyce /
Published under (CC) BY-NC-SA in categories java  tagged with browser  http