问题描述
- java程序执行linux命令;;;求大神啊+++++++++++++
-
java程序执行linux命令,按照三个条件查询service.log里信息 如何实现啊
时间条件是每天的log日期,waybillNo,opOrgCode
日志里每条记录是一串json
{"pdaUuid":"f2b0fa0db0e749a0959ad22620cb06c4","goodsType":"","effectiveType":"","frequencyNo":"","weight":"","inputWeight":"","waybillNo":"3301825256335","expType":"10","lastOrgCode":"","opOrgCode":"611731","opCode":"520","auxOpCode":"NEW","deviceType":"PDA","clientProgramRole":"0","opTerminal":"150400140101491","opUserCode":"6117310585","opTime":"2015-09-10 07:12:56","inTime":"2015-10-10 13:48:18"}
解决方案
java程序执行Linux命令
Java程序执行Linux命令
Java程序执行Linux命令
解决方案二:
读取文件内容,然后按json格式来解析,获取对应的数据
http://www.cnblogs.com/lanxuezaipiao/archive/2013/05/24/3096437.html
解决方案三:
可以使用Runtime.exec 方法执行外部的命令,我这个是执行windows下执行arp命令,在Linux下应该是类似的,
Runtime r = Runtime.getRuntime();
Process p = r.exec("arp -a");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
时间: 2024-11-01 08:27:26