public class FileMode {
public static void changeFileModeByCmd(String file) {
String[] command = {"chmod", "777", file};
ProcessBuilder builder = new ProcessBuilder(command);
try {
builder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void changeFileModeBySys(String filename) {
try {
Process p = Runtime.getRuntime().exec("chmod 644 " + filename);
int status = p.waitFor();
if (status == 0) {
} else {
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}