当前位置:编程学习 > JAVA >>

请教一个“Java SE编程中的”“调试问题”...

高手,您好:
    下面的代码,它的功能是:
    “进行本地PC中的指定文件类型的文件的查找”的功能.
    
    希望得到您的指导:
    为什么这个曾经得到CSDN高手指导的类文件,在已经得到了功能的实现之后,现在在整个MyEclipse中的console窗口中,显示出的是一个“重新出现一堆错儿”的界面:
    
    高手,整个程序的源代码如下:
    
package c_port_packageDoctor;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;

public class CheckAndConfirmworker {
static C_port_Our_honor fileDS = null;
HashMap<String,String> fileset = null;
static ArrayList<String> thecommonfruitPath = new ArrayList<String>();
static ArrayList<String> thevideofruitPath = new ArrayList<String>();
static ArrayList<String> thecommonfruitFullname = new ArrayList<String>();
static ArrayList<String> thecommonfruitExtenName = new ArrayList<String>();
static ArrayList<String> thecommonfruitpreName = new ArrayList<String>();
static ArrayList<String> thecommonvideoExtenName = new ArrayList<String>();
static ArrayList<String> thevideoFullName = new ArrayList<String>();
static ArrayList<String> thevideofruitpreName = new ArrayList<String>();
static ArrayList<String> thevideofruitFullName = new ArrayList<String>();
static ArrayList<String> thevideofruitExtenName = new ArrayList<String>();
static int calc0 = 0;
static int calc1 = 0;
static File file = new File("E:\\");  
static int j = 0;
static int t = 1;

//获取文件扩展名
public static String getExtensionName(String filename) {   
if ((filename != null) && (filename.length() > 0)) {   
int dot = filename.lastIndexOf('.');   
if ((dot >-1) && (dot < (filename.length() - 1))) {   
return filename.substring(dot + 1);   
}   
}   
return filename;   
}  

//获取去掉扩展名的文件名
public static String getpreFileName(String filename) {   
if ((filename != null) && (filename.length() > 0)) {   
int dot = filename.lastIndexOf('.');   
if ((dot >-1) && (dot < (filename.length()))) {   
return filename.substring(0, dot);   
}   
}   
return filename;   
}  



public static void main(String[] args){
findthecommonfruit(file);
for(int i = 0;i<calc0 ;i++){
System.out.println(thecommonfruitExtenName.get(i));
}
}


static public void findthecommonfruit(File file){
File[] files1 = null;
files1 = file.listFiles();
if(files1==null||files1.length==0){
return ;
}
for(int i=0;i<files1.length;i++){
if(files1[i].isDirectory()){
findthecommonfruit(files1[i]);
}
for(i=0;i<files1.length;i++){
if(files1[i].isDirectory()){
findthevideofruit(files1[i]);
}
//System.out.println(files[i]);
else if(files1[i].getPath().endsWith("ppt")||files1[i].getPath().endsWith("doc")||files1[i].getPath().endsWith("txt")||files1[i].getPath()
.endsWith("wps")||files1[i].getPath().endsWith("excel")||files1[i].getPath().endsWith("jude")||files1[i].getPath().endsWith("bmp")
||files1[i].getPath().endsWith("c")||files1[i].getPath().endsWith("cpp")||files1[i].getPath().endsWith("java")||files1[i].getPath().endsWith("js")
||files1[i].getPath().endsWith("asp")||files1[i].getPath().endsWith("jsp")||files1[i].getPath().endsWith("php")||files1[i].getPath().endsWith("pdf")
||files1[i].getPath().endsWith("jpeg")||files1[i].getPath().endsWith("gif")||files1[i].getPath().endsWith("html")||files1[i].getPath().endsWith("png")
||files1[i].getPath().endsWith("xls")||files1[i].getPath().endsWith("zip")){
thecommonfruitPath.add(files1[i].getAbsolutePath());
thecommonfruitFullname.add(files1[i].getName());
thecommonfruitpreName.add(getpreFileName(files1[i].getName())); 
thecommonfruitExtenName.add(getExtensionName(files1[i].getName()));
++calc0;
}
}
}
// return thecommonfruitPath;
}

static public void findthevideofruit(File file){
File[] files2 = null;
files2 = file.listFiles();
if(files2 == null){
return;
}
for(int i=0;i<files2.length;i++){
if(files2[i].isDirectory()){
findthecommonfruit(files2[i]);
}
for(i=0;i<files2.length;i++){
if(files2[i].isDirectory()){
findthevideofruit(files2[i]);
}
//System.out.println(files[i]);
else if(files2[i].getPath().endsWith("3GP")||files2[i].getPath().endsWith("mid")||files2[i].getPath().endsWith("mp4")||files2[i].getPath()
.endsWith("flash")||files2[i].getPath().endsWith("rm")||files2[i].getPath().endsWith("rmvb")||files2[i].getPath().endsWith("wma")
||files2[i].getPath().endsWith("avi")){
thevideofruitPath.add(files2[i].getAbsolutePath());
thevideofruitFullName.add(files2[i].getName());
thevideofruitpreName.add(getpreFileName(files2[i].getName())); 
thevideofruitExtenName.add(getExtensionName(files2[i].getName()));
++calc1;
}
}
}
// return thevideofruitPath;
}


public static ArrayList<String> giveCsectorcommonFilepath(){
return thecommonfruitPath;
}

public static ArrayList<String> giveCsectorvideoFilepath(){
return null;
}

public static ArrayList<String> giveDsectorcommonFilepath(){
return null;
}

public static ArrayList<String> giveDvideocommonFilepath(){
return null;
}

public static ArrayList<String> giveEsectorcommonfilepath(){
return null;
}

public static ArrayList<String> giveEsectorvideofilepath(){
return null;
}

public static ArrayList<String> giveFsectorcommonfilepath(){
return null;
}

public static ArrayList<String> giveFsectorvideofilepath(){
return null;
}
}

    希望能够得到高手的指导!!
    谢谢高手的点拨!!
    一百分奉上!!
                                                           一位日日夜夜向着理想奔跑的筑梦者
                                                                2013年8月14日下午15点正 编程 Java SE 调试 Java代码错误排查 --------------------编程问答--------------------
内存溢出了呗
估计你C盘文件太多了吧!
既然查找指定类型,为什么不弄个文件过滤器呢! --------------------编程问答-------------------- 建index再查比较高效。
递归层数过多,没办法的 --------------------编程问答-------------------- LZ是小号流吗 --------------------编程问答-------------------- 围观学习。。。。 --------------------编程问答-------------------- 内存益处,把jvm内存调大点试试,或者程序优化一下。
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,