calling a setReadOnly() on file or directory having 777 permission removes the write permission but leaves execute permission intact.
r_x r_x r_x
Tried on RH Linux Advanced Server 3.0 and Solaris-9 using Tiger-rc Build 63
How to reproduce the stuff:-
create a sample file say check.txt
give 777 permission
compile and execute below mentioned code:-
import java.io.*;
import java.util.*;
public class Test4 {
public void check() {
try {
File file = new File("check.txt");
System.out.println("Going to make it read only:"+file.setReadOnly());
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
Test4 ref = new Test4();
ref.check();
}
}
After executing check the permission on check.txt file using ls -la
r_x r_x r_x
Tried on RH Linux Advanced Server 3.0 and Solaris-9 using Tiger-rc Build 63
How to reproduce the stuff:-
create a sample file say check.txt
give 777 permission
compile and execute below mentioned code:-
import java.io.*;
import java.util.*;
public class Test4 {
public void check() {
try {
File file = new File("check.txt");
System.out.println("Going to make it read only:"+file.setReadOnly());
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
Test4 ref = new Test4();
ref.check();
}
}
After executing check the permission on check.txt file using ls -la