我试图使用javaexec编写python脚本的输出文件,但是没有得到任何输出。 我得到了预期的文件,但它是空的。 我做了一个剧本做我想做的。你知道吗
#!/bin/bash/
cd /home/taste/work/AIR/air/
python configure -f .air_config
我已经尝试从shell执行这个脚本,并且可以得到输出。你知道吗
Process p = Runtime.getRuntime().exec(new String[]{"bash","-c","sh
./Configuration_Data/Scripts/"+cF.folderName+"/testConfigure.sh >
configureOut.txt"});
我是这样读的:
String line ="";
//Used to create output
StringBuilder text = new StringBuilder();
BufferedReader input = new BufferedReader(new
InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
text.append(line+"\n");
System.out.println(line);
}
我想从我的python文件中得到输出。你知道吗
谢谢你。你知道吗
由于您使用
> configureOut.txt
将脚本的输出定向到文件,因此从输入流中没有什么可读取的了。如果您真的希望输出同时出现在文件和输入流中,可以将上述重定向更改为| tee configureOut.txt
。你知道吗相关问题 更多 >
编程相关推荐