当前位置 : 主页 > 编程语言 > java >

java调用其他语言代码

来源:互联网 收集:自由互联 发布时间:2022-07-07
final Runtime runtime = Runtime . getRuntime (); Process process = null ; String [] cmds = { "D:\\APP\\python\\python.exe" , "E:\\theatre\\src\\test\\java\\com\\devin\\web\\controller\\test.py" }; try { process = new ProcessBuilder ( cmds )
final Runtime runtime = Runtime.getRuntime();
Process process = null;
String[] cmds = {"D:\\APP\\python\\python.exe","E:\\theatre\\src\\test\\java\\com\\devin\\web\\controller\\test.py"};
try {
process = new ProcessBuilder(cmds).start();
BufferedReader stdout = new BufferedReader(new InputStreamReader(process.getInputStream()));
String l;
l = stdout.readLine();//读取一行
System.out.println(l);
}
catch(Exception e) {
System.out.println(e.getMessage());
}


上一篇:MultipartFile 对象创建用于oss上传测试
下一篇:没有了
网友评论