try { process = Runtime.getRuntime().exec(cmd); BufferedReader prcout = new BufferedReader( new InputStreamReader( new BufferedInputStream(process.getInputStream()))); while ((line=prcout.readLine()) != null){ coll.add(line); process.waitFor(); } prcout.close();
另外JPasswordField可以设置显示的符号,你想显示*号或#号,或任何其它符号都可以
StringBuilder sb=new StringBuilder();//用于存放字符内容
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
sb.insert(offs,str);
StringBuilder s=new StringBuilder(str);
for(int i=0;i<s.length();i++)
s.setCharAt(i,'#');//替换成回显字符
super.insertString(offs,s.toString(),a);
}
public String getText(int offset, int length)
throws BadLocationException {
return sb.substring(offset,offset+length);//返回字符实际内容
}
public void remove(int offs, int len) throws BadLocationException {
sb.delete(offs,offs+len);//删除
super.remove(offs, len);
}
});
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);
Process process;
String line;
try {
process = Runtime.getRuntime().exec(cmd);
BufferedReader prcout = new BufferedReader(
new InputStreamReader(
new BufferedInputStream(process.getInputStream())));
while ((line=prcout.readLine()) != null){
coll.add(line);
process.waitFor();
} prcout.close();
} catch (IOException ex) {
ex.printStackTrace();
}
return coll;
} 调用perl脚本!其中perl脚本是用来查询数据库中的满足条件的所有记录!当我输入日期后 需要将查询出的数据全部放在集合中!但 程序进行到while条件处 就不在继续,也不报错,也无异常!!!!!是否因为查询出数据量过大的原因呢! 我想是因为和缓冲有关的问题!但是一直都是没有解决掉!!