Der Compiler gibt mir für Zeile 25 folgenden Fehler aus:
Code
pussy/LoadDictionarys.java [25:1] cannot resolve symbol
symbol : method listFiles (pussy.FilenameFilter)
location: class java.io.File
File[] contents = myDir.listFiles(select);
^
1 error
Errors compiling LoadDictionarys.
Das dumme ist nur: Ich komme einfach nicht drauf wo genau der Fehler liegt. Mir erscheint in meinem Code so weit alles logisch.
Vielleicht könnte mal einer von euch einen kleinen Blick auf den Code werfen:
Java
package pussy;
import java.io.*;
import java.util.Date;
public class LoadDictionarys {
/** Creates a new instance of LoadDictionarys */
public LoadDictionarys() {
if (pussy.Pussy.cout == true) System.out.println("LOADDICTIONARYS started");
File myDir = new File("C:/Dokumente und Einstellungen/Eigene Dateien/Devel/pussy/pussy/");
if (pussy.Pussy.cout == true) System.out.println(myDir.getAbsolutePath() + (myDir.isDirectory()?" is ":" is not ") + "a directory");
if (pussy.Pussy.cout == true) System.out.println("The parent of " + myDir.getName() + " is " + myDir.getParent());
FilenameFilter select = new FileListFilter("c", "java");
File[] contents = myDir.listFiles(select);
//File[] contents = myDir.listFiles();
if (contents!=null){
if (pussy.Pussy.cout == true) System.out.println("The " + contents.length + " items in the directory " + myDir.getName() + " are:");
for(int i = 0; i < contents.length; i++)
if (pussy.Pussy.cout == true) System.out.println(contents[i] + " is a " + (contents[i].isDirectory() ? "directory":"file") + " last modified " + new Date(contents[i].lastModified()));
}
else {
if (pussy.Pussy.cout == true) System.out.println(myDir.getName() + " is not a directory");
}
if (pussy.Pussy.cout == true) System.out.println("LOADDICTIONARYS terminated correctly");
}
}
interface FilenameFilter {
public abstract boolean accept(File directory, String filename);
}
interface FileFilter {
public abstract boolean accept(File pathname);
}
class FileListFilter implements FilenameFilter {
private String name;
private String extension;
// Constructor
public FileListFilter(String name, String extension){
this.name = name;
this.extension = extension;
}
public boolean accept(File directory, String filename) {
boolean fileOK = true;
if(name != null)
fileOK &= filename.startsWith("." + extension);
if(extension != null)
fileOK &= filename.endsWith("." + extension);
return fileOK;
}
}
Alles anzeigen