Process process = Runtime.getRuntime().exec(cmd);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s = br.readline();
可以得到一般命令的输出,但是GCC编译出错时结果得不到
Process process = Runtime.getRuntime().exec(cmd);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s = br.readline();
可以得到一般命令的输出,但是GCC编译出错时结果得不到
收起
后来我尝试用gcc a.cpp -o a.cpp 2> result.txt 将a.cpp编译结果输出到result.txt中 问题得以解决
报告相同问题?