I am using Window's 8 and writing a JAVA code to create new folder "ABC" under "C:\Program Files" with Read and Write privileges for all users.
But after execution of program, folder is not created in specified path.
I am using following code to create a folder.
public class PermissionTest {
public static void main(String[] args) {
String path = "C:\\Program Files\\ABC";
//String path = "D:\\ABC";
File file = new File(path);
file.mkdirs();
file.setReadable(true, false);
System.out.println("ABC readable "+file.canRead());
file.setWritable(true, false);
System.out.println("ABC writable "+file.canWrite());
file.setExecutable(true, false);
System.out.println("ABC executable "+file.canWrite());
}
}
Output:
ABC readable false
ABC writable false
ABC executable false
Is there any other approach to create a folder and assign Read and Write permission to all user under "C:\Program Files"?
Please Advise.