filepermission


2004-02-18 08:54:46 PM
jbuilder14
Hi,
I want to check wether i can write in a directory
using following codesnippet
try {
String curDir = System.getProperty("user.dir");
AccessController.checkPermission(new FilePermission("C:\\tempie\\-",
"read"));
System.out.println("Writing and reading permission on :"+ curDir);
// Has permission
} catch (SecurityException e) {
String curDir = System.getProperty("user.dir");
System.out.println("No writing or reading permissions on "+ curDir);
// Does not have permission
}
But allways throws the exception what can be wrong?
even if i use the curDir string it goes wrong
Sven