【发布时间】:2013-05-25 16:26:13
【问题描述】:
我有一个名为 pbp 的 perl 脚本,它接受一个 html 文件作为参数,然后创建一个输出文件。这是我当前的代码。 Infile 是较早从 JFile 选择器获得的。我没有收到任何错误,但 perl 脚本没有输出。
try {
Process p = Runtime.getRuntime().exec(new String[] {"perl", "C:\\Users\\Roger\\Downloads\\The_Long-Awaited_Product_Specification_and_Sample_Files\\casey\\pbp", inFile.getAbsolutePath()});
p.getInputStream().close();
p.getOutputStream().close();
p.getErrorStream().close();
System.out.println(p.waitFor());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
【问题讨论】:
-
而且 perl 在命令行中运行良好?
-
你能展示一下perl脚本的相关部分吗?
-
perl 从命令行正常工作。
标签: java perl runtime runtime.exec