/**
     * Get the all the filenames with absolute path
     * All the files fullpath will be store in vector
     * @return the path name
     */
    public static void getFilesRecursive(File dir,Vector v)
    {
        if(dir.isDirectory())
        {
            String path = dir.getAbsolutePath();
            String sub[] = dir.list();
            for(int i = 0;i<sub.length;i++)
            {
                File f = new File(path + File.separator + sub[i]);
                getFilesRecursive(f,v);
            }
        }
        else
        {            String tmp = dir.getAbsolutePath();
            v.add(tmp);
            //System.out.println(tmp);
        }    }

解决方案 »

  1.   

    去看看api里的File,会对你有很大帮助的
      

  2.   

    File fp = new File( "." );
            String s[] = {};
            if( fp.isDirectory() ) {
                s = fp.list();
            }
            for( int i = 0; i < s.length; i ++ ) {
                JOptionPane.showMessageDialog( this.getOwner(), s[i] );
            }
      

  3.   

    File[] fileList = FileSystemView.getFileSystemView().getFiles("目录名",true);
      

  4.   

    写错了,应该是
    File[] fileList = FileSystemView.getFileSystemView().getFiles(new File("目录名"),true);