java.io.IOException: Cannot run program "cat /opt/parser/standalone/log/server.log.2015-09-24|grep ''waybillNo':'229412652241''|grep ''opOrgCode':'226000''|grep ''opCode':'795''": error=2, No such file or directory
执行这条命令报错了,求大神指教
javac -cp /home/oracle/export/lib/ojdbc14.jar.jar:/home/oracle/export/lib/poi-ooxml-3.9-20121203.jar:/home/oracle/export/lib/poi-3.9-20121203.jar:/home/oracle/export/lib/poi-ooxml-schemas-3.9-20121203......
答案就在这里:在linux上执行java
----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?
1.首先确认一下:linux命令的正确性;
2. /opt/parser/standalone/log/server.log.2015-09-24等 中是否有需要转义的特殊字符。
用下面的代码测试时正确的
Runtime runtime = Runtime.getRuntime();
Process process = null;
BufferedReader reader = null;
String command = "cat /opt/test.txt |grep \"test\"";
try {
process = runtime.exec(command);
int retCode = process.waitFor();
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
System.out.println("oooo" + reader.readLine());
}
1.首先确认一下:linux命令的正确性;
2. /opt/parser/standalone/log/server.log.2015-09-24等 中是否有需要转义的特殊字符。
用下面的代码测试时正确的
Runtime runtime = Runtime.getRuntime();
Process process = null;
BufferedReader reader = null;
String command = "cat /opt/test.txt |grep \"test\"";
try {
process = runtime.exec(command);
int retCode = process.waitFor();
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
System.out.println("oooo" + reader.readLine());
}
/cat /opt/parser/standal......
自己先在shell上试一试