代码执行时项目不响应

时间:2012-08-16 22:19:16

标签: java swing runtime processbuilder

没有错误没有输出,无法理解哪里出错。

String[] commands = new String[] {"maude", "in 1.maude", "red f(a, b, e) ."};
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(commands);
InputStream stdin = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
while ( (line = br.readLine()) != null) {
    jTextArea4.append(line + "\n");
}

最初,我有一个字符串数组,第一个运行Maude控制台,第二个是Maude控制台的命令,它说明我们感兴趣的模块(文件)是什么(要加载哪个文件),以及最后一个是检查Maude模块中某些属性的实际命令!

1 个答案:

答案 0 :(得分:2)

使用:

String maudeCommand = "full_path_to_maude\\maude.exe";
String[] commands = new String[] {"cmd.exe", "/c", maudeCommand, "in", "1.maude", "red", "f(a, b, e)", "."};

full_path_to_maude替换为 maude.exe 的位置。