改成这样就没问题了Vector vt = new Vector(1, 1);
public Vector getDir(String strPath) { try {
File f = new File(strPath);
if (f.isDirectory()) {
File[] fList = f.listFiles();
for (int j = 0; j < fList.length; j++) {
if (fList[j].isDirectory()) {
String str =fList[j].getPath();
System.out.println(str);
getDir(fList[j].getPath());
}else {
vt.add(fList[j].getPath());
} } }
return vt;
}
catch (Exception e) {
e.printStackTrace();
System.out.println("Error: " + e);
return null;
}
}
public Vector getDir(String strPath) { try {
File f = new File(strPath);
if (f.isDirectory()) {
File[] fList = f.listFiles();
for (int j = 0; j < fList.length; j++) {
if (fList[j].isDirectory()) {
String str =fList[j].getPath();
System.out.println(str);
getDir(fList[j].getPath());
}else {
vt.add(fList[j].getPath());
} } }
return vt;
}
catch (Exception e) {
e.printStackTrace();
System.out.println("Error: " + e);
return null;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货