springBoot项目中调用C#编写的exe程序
//调用TEST_001
id:参数,path:你TEST_001.exe的路径
Printer printer=new Printer();
Process po = printer.runExe(path+“\TEST_001.exe”,id.toString());//路径和参数
int number = po.waitFor();
/**
- 执行exe程序
- @param path
- @param params
- @return
*/
public Process runExe(String path,String params) {
Runtime rn = Runtime.getRuntime();
Process p = null;
String[] parm = {path,params};
try {
p = rn.exec(parm);//执行exe
} catch (Exception e) {
System.out.println(“Error exec!”);
}
return p;
}