调用其他的可执行文件,例如:自己制作的exe,或是下载安装的软件
public void RunBat(String filepath)throws Exception{
String str=filepath+"execute.bat";
try{
Process p=Runtime.getRuntime().exec(str);
InputStream in=p.getInputStream();
int c;
while((c=in.read())!=-1){
System.out.print(c);
}
in.close();
p.waitFor();
}catch(Exception e){
e.printStackTrace();
}
}
public void RunBat(String filepath)throws Exception{
String str=filepath+"execute.bat";
try{
Process p=Runtime.getRuntime().exec(str);
InputStream in=p.getInputStream();
int c;
while((c=in.read())!=-1){
System.out.print(c);
}
in.close();
p.waitFor();
}catch(Exception e){
e.printStackTrace();
}
}