"File" don't work with Processing 2.0b7
in
Programming Questions
•
10 months ago
I'm just trying with Processing 2.0b7 a project who worked fine with Processing 1.5 and I'm very surprised to see this error message:
Cannot find a class or type named "File"
This error blocks the following function, making all my works useless... I see no way to turn the class File for deleting text files or for reading directories.
public static void delete(String fileName) {
//String fileName = sketchPath(f);
try {
File target = new File(fileName);
if (!target.exists()) {System.err.println("File " + fileName + " not present to begin with!");return;}
if (target.delete()) System.err.println("** Deleted " + fileName + " **");
else System.err.println("Failed to delete " + fileName);
} catch (SecurityException e) {
System.err.println("Unable to delete " + fileName + "(" + e.getMessage() + ")");
}
}
String[] myDirectory(String dir) {
File file = new File(sketchPath(dir));
if (file.isDirectory()) {
String names[] = file.list();
return names;
} else {
String[]s=new String[0];
return s;
}
}
So I try the "examples" for 2.0b7 and found a sketch named "DirectoryList"... but it use the File class and don't work too.
I'm on windows 7, I have no problems with olders versions of Processing except that applications don't work on my computer (but fine in most friend's computers).
Cannot find a class or type named "File"
This error blocks the following function, making all my works useless... I see no way to turn the class File for deleting text files or for reading directories.
public static void delete(String fileName) {
//String fileName = sketchPath(f);
try {
File target = new File(fileName);
if (!target.exists()) {System.err.println("File " + fileName + " not present to begin with!");return;}
if (target.delete()) System.err.println("** Deleted " + fileName + " **");
else System.err.println("Failed to delete " + fileName);
} catch (SecurityException e) {
System.err.println("Unable to delete " + fileName + "(" + e.getMessage() + ")");
}
}
String[] myDirectory(String dir) {
File file = new File(sketchPath(dir));
if (file.isDirectory()) {
String names[] = file.list();
return names;
} else {
String[]s=new String[0];
return s;
}
}
So I try the "examples" for 2.0b7 and found a sketch named "DirectoryList"... but it use the File class and don't work too.
I'm on windows 7, I have no problems with olders versions of Processing except that applications don't work on my computer (but fine in most friend's computers).
1