Really thanks, i think i reached my goal ...
I create a file at the path "/home/policy" which contains this lines :
grant {
permission java.lang.RuntimePermission "setSecurityManager";
permission java.lang.RuntimePermission "createSecurityManager";
permission java.lang.RuntimePermission "usePolicy";
};
And i try this code which give me error for only read a file with right 777 :
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
import java.io.IOException;
public class Main extends SecurityManager {
public static void main(String[] args) {
// set the policy file as the system securuty policy
System.setProperty("java.security.policy", "file:/home/java.policy");
// create a security manager
Main sm = new Main();
// set the system security manager
System.setSecurityManager(sm);
System.out.println("Test");
//lit un fichier
BufferedReader br = null;
try {
String sCurrentLine;
br = new BufferedReader(new FileReader("/home/a.txt"));
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
// print a message if we passed the check
System.out.println("Allowed!");
}
}
I hope that it's the right way ... Thanks for your help
Thomas