阅读背景:

java程序打开本地文件程序的两种方法,以及java程序中打开网页

来源:互联网 

两种方法可以打开本地程序:

public class Open {
	public static void main(String[] args) throws Exception {
	//打开本地程序文件方式1
	 Runtime rt = Runtime.getRuntime();
	 String fileLac = "D:\HBuilder\HBuilder.exe";
         rt.exec(fileLac);
	//打开本地程序文件方式2
         Desktop desktop = Desktop.getDesktop();
         File file = new File("C:/Windows/System32\cmd.exe");
         desktop.open(file);
       //打开本地网站,默认浏览器打开
         URI uriNet = new URI("www.baidu.com");
         Desktop.getDesktop().browse(uriNet);
	}
}public class Open {
	public 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: