Java笔记——Java调用exe文件

public class CallEXE {
	@Test
	public void test(){
		//test1_0();
		test2_0();
	}
	public void test1_0(){
		Runtime runtime = Runtime.getRuntime();
		Process process = null;
		try{
			process = runtime.exec("notepad");
		}catch (Exception e) {
			System.out.println("Error in running notepad.exe");
		}
	}
	public void test2_0(){
		Runtime runtime = Runtime.getRuntime();
		Process process = null;
		try {
			process = runtime.exec("\"D:\\Program Files\\UltraEdit\\Uedit32.exe\"");
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}


 

你可能感兴趣的:(java,exception,Class,exe)