How to specify the readable by everyone permission on which data is being written by java.util.logging.FileHandler
I want to give 755 kind of permission, so that other unix groups can also read these log files.
How to specify the readable by everyone permission on which data is being written by java.util.logging.FileHandler
I want to give 755 kind of permission, so that other unix groups can also read these log files.
This piece of code converts the permission of an existing file to a full permission 0777:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermissions;
public class testFile {
public static void main(String[] args) throws SecurityException, IOException {
String dir= "path to your file/test.txt";
Path path = Paths.get(dir);
try {
// permission 0777
Files.setPosixFilePermissions(path, PosixFilePermissions.fromString("rwxrwxrwx"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}