1.0 用java调用windows系统的exe文件,比如notepad,calc之类:
public class demo{
public static void main(string args[]){
runtime rn=runtime.getruntime();
process p=null;
try{
p=rn.exec(notepad);
}catch(exception e){
system.out.println("error exec notepad");
}
}
}
2.0调用其他的可执行文件,例如:自己制作的exe,或是下载安装的软件
public class demo{
public static void main(string args[]){
runtime rn=runtime.getruntime();
process p=null;
try{
p=rn.exec("\"d:/anyq/anyq.exe\"");
}catch(exception e){
system.out.println("error exec anyq");
}
}
}
