No class def find error

Posted by John Smith on Stack Overflow See other posts from Stack Overflow or by John Smith
Published on 2014-08-19T09:51:18Z Indexed on 2014/08/19 10:20 UTC
Read the original article Hit count: 134

Filed under:
|
|

I have the following piece of code which helps me to read the paths of all the files in a directory and its subdirectories :

File dir = new File("directory path");

                try {
                    System.out.println("Getting all files in " + dir.getCanonicalPath() + " including those in subdirectories");
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
                List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
                for (File file : files) {
                    try {
                        System.out.println("file: " + file.getCanonicalPath());
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }

The problem is that I get a java.lang.NoClassDefFoundError: org/apache/commons/io/filefilter/TrueFileFilter error.

I've imported the necessary libraries. I mention that I work on a plugin project. This code runs in a class with main function. I don't understand why it gave me this error. Thank you !

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about plugins