有的时候我们想要在程序中自启动某个程序,在程序的代码中可以加入如下程序代码。

// 启动google Earth
	public void startGoogleEarth() throws IOException {

		Runtime.getRuntime().exec("cmd.exe   /c  "+ " start D:\\software\\
		Googleearth\\client\\googleearth.exe  ");

	}

Runtime取得实例后,加入CMD命令把你要启动的程序的安装目录修改一下就OK了。