public Collection getDprcInfo(StringBuffer permid,StringBuffer begDt,StringBuffer endDt) throws InterruptedException{
Collection coll = new ArrayList();
System.out.println("prel");
String perlCmd = "C:/Scripts/get_sec_dprc_info.pl --Permid "+permid.toString()+" --beg "+begDt.toString()+" --end "+endDt.toString();
String cmd = "C:\\cygwin\\bin\\bash.exe -lc \"perl "+perlCmd+" \" ";
System.out.println(cmd);
try {
Process process;
String line;
process = Runtime.getRuntime().exec(cmd);
BufferedReader prcout = new BufferedReader(
new InputStreamReader(
new BufferedInputStream(process.getInputStream())),50); while ((line=prcout.readLine()) != null){
coll.add(line); process.waitFor();
} prcout.close();
prcout.close();
} catch (IOException ex) {
ex.printStackTrace();
}
return coll;
}我需要在java中调用外部命令利用cygwin\\bin\\bash.exe 执行一条脚本语句!脚本是查询数据库中的数据,脚本中有3个参数!当我需要查询2个日期间的数据时,输入7天内的数据可以查询出结果!但是如果查询较长时期的数据 就会在while ((line=prcout.readLine()) != null) 卡住!无异常 无错,有可能是缓冲问题!!!!!但是一直无法解决!!!希望高手帮忙
解决方案 »
- 设置后台线程出问题了,why? this is why??
- 进度条
- 最后10分 问个正则表达式的问题
- java.util.set用法
- 如何在IE的工具条位置加上自己的工具条(象google的工具条)??
- 继承HashSet问题
- Synchronized的问题
- 用applet传图像给servlet 该怎样做?
- 如何手动实现Drag&Drop
- 请问:Action接口的PropertyChanged事件有什么触发?什么含义?
- java中jdbc怎么链接sqlserver数据库,请高手帮帮
- 请问不使用isAutoIncrement()函数用DatabaseMetaData对象可以检测自动编号的字段吗?
这个命令很疆的,以前我用这个东西做做copy都会出问题。估计你上面的脚本还没运行完。java已经跑到下面执行 while ((line=prcout.readLine()) != null){ 在process = Runtime.getRuntime().exec(cmd);下面sleep一下看看呢?
但是还是无法解决