Java执行exe,bat等可执行文件
Process proc = Runtime.getRuntime().exec(command);
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CallExe {
public static void main(String[] args) {
String text = null;
String command = "C:Program FilesYodaoDeskDictRunDict.exe";//exe,bat文件名OR DOS命令
try {
Process proc = Runtime.getRuntime().exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while ((text = in.readLine())!= null) {
System.out.println(text); //输出测试
}
} catch (IOException ioError) {
ioError.printStackTrace();
System.exit(0);
}
}
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。