public static void recursion(File file) throws IOException{
BufferedWriter bw = new BufferedWriter(new FileWriter("path.txt",true));
File[] files = file.listFiles();
for (File file2 : files) {
if(file2.isDirectory()){
recursion(file2);
}else if(file2.isFile()&&file2.getName().endsWith(".java")){
bw.write(file2.getAbsolutePath());
bw.newLine();
bw.flush();
bw.close();
}
}
}
}
下面是问题的信息 弄不明白 头疼死了
at java.io.BufferedWriter.write(BufferedWriter.java:203)
at java.io.Writer.write(Writer.java:140)
at com.hgm.io.Recursion.recursion(Recursion.java:27)
at com.hgm.io.Recursion.recursion(Recursion.java:25)
at com.hgm.io.Recursion.recursion(Recursion.java:25)
at com.hgm.io.Recursion.recursion(Recursion.java:25)
at com.hgm.io.Recursion.recursion(Recursion.java:25)
at com.hgm.io.Recursion.main(Recursion.java:17)