public static void getVidio(String path){
File fil = new File(path);
File[] files = fil.listFiles();
count++;
if(count > 15000){
System.out.println(count);
return;
}
getVidio(path);
}
Exception in thread "main" java.lang.StackOverflowError请问怎么处理这个问题啊,我想做一个全盘扫描,扫描文件多了,就报这个错误。
File fil = new File(path);
File[] files = fil.listFiles();
count++;
if(count > 15000){
System.out.println(count);
return;
}
getVidio(path);
}
Exception in thread "main" java.lang.StackOverflowError请问怎么处理这个问题啊,我想做一个全盘扫描,扫描文件多了,就报这个错误。
解决方案 »
- 加密class文件后spring启动失败的问题(使用ClassFileTransformer解密加密的类)
- ip字符串排序
- 谁帮我下,用户注册,注册成功之后然后在邮箱里面激活刚注册的用户,数据存储是用xml传得,不是存数据库的,谁帮忙下
- 目前对 hadoop 的前景了解甚少,不知道他的前途如何,有经验的给点建议啊
- struts2 treenode javascript调用
- 有关jDBC调用存储过程
- spring跑不动, 那位大哥帮忙看一下!
- 新手请教
- 如何解决struts2 乱码的问题
- 哪里有j2eeSDK的类库说明?给个地址好吗?
- 一个primefaces中p:commandButton组件无法以ajax方式调用bean的问题
- 求教各位大侠如何学习JAVAEE..............
楼主这个count++ 之前 是否该加个判断语句 ?
File fil = new File(path);
File[] files = fil.listFiles();
count++;
if(count > 15000){
System.out.println(count);
return;
}
getVidio(path); //这不是死循环吗
}
if(count > 15000){
System.out.println(count);
return;
}
File fil = new File(path);
File[] files = fil.listFiles();
count++;
if(count > 15000){
System.out.println(count);
return;
}
getVidio(path);
}
看不明白,为什么path路径不会改变的?
for(File f:files){getVidio(f.getName())}
然后,else不是文件夹,就把它统计count++;return;
这是才递归,你写的那个递归,我还真看不懂,可能我技术太差吧,看不懂那么深的逻辑!