求解 运行出错 java.io.FileNotFoundException: e:\ (系统找不到指定的路径。)

BananaOrz 2013-04-08 12:48:39
public void search(){
System.out.println("文件名称\t文件所在路径");
try {

File file = new File(StreamPath);
File files[] = file.listFiles();
if (files != null) {
for (File f : files) {

if (f != null) {
if (f.isFile()) {
String str =f.getName();
FileReader fr =new FileReader(StreamPath);
BufferedReader br =new BufferedReader(fr);

// if(br.equals(StreamName)){
// System.out.print(name+"\t");
// System.out.println(StreamName);
// }
String line ="";
while((line=br.readLine()).contains(StreamName)){
System.out.print(str+"\t");
System.out.println(f.getAbsolutePath());
}
br.close();
fr.close();
}


if (f.isDirectory()) {
// 文件夹的名称
String bufferPath =StreamPath+"\\"+f.getName()+"\\";
recursionSearch(bufferPath);
}
}

}
}
} catch (Exception ex) {
ex.printStackTrace();
}

}
public void recursionSearch(String bufferPath){
try{
File file = new File(bufferPath);
File files[] = file.listFiles();
if (files != null) {
for (File f : files) {

if (f != null) {
if (f.isFile()) {
String str =f.getName();
FileReader fr =new FileReader(bufferPath);
BufferedReader br =new BufferedReader(fr);

// if(br.equals(StreamName)){
// System.out.print(name+"\t");
// System.out.println(StreamName);
// }
String line ="";
while((line=br.readLine()).contains(StreamName)){
System.out.print(str+"\t");
System.out.println(f.getAbsolutePath());
}
br.close();
fr.close();
}


if (f.isDirectory()) {
// 文件夹的名称
bufferPath =StreamPath+"\\"+f.getName()+"\\";
recursionSearch(bufferPath);
}
}

}
}




}catch(Exception ex){
ex.printStackTrace();
}
}
...全文
978 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
大_爱 2013-04-08
  • 打赏
  • 举报
回复
引用 2 楼 fangmingshijie 的回复:
e盘下没有你的文件。
就是这样瞄!
  • 打赏
  • 举报
回复
e盘下没有你的文件。
Inhibitory 2013-04-08
  • 打赏
  • 举报
回复
文件的路径不对
BananaOrz 2013-04-08
  • 打赏
  • 举报
回复
应该不是那个问题 好像是while中死循环了

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧