Code example for FilePermission

Methods: newPermissionCollection

    static void tryFilePC() throws Exception { 
        try { 
            FilePermission p0 = new FilePermission("/home/foobar","read");
            PermissionCollection pc = p0.newPermissionCollection();
            pc.setReadOnly();   // this should lock out future adds
            FilePermission p1 = new FilePermission("/home/quux","read");
            throw new 
                Exception("Failed...FilePermission added to readonly FilePermissionCollection.");
        } catch (SecurityException se) {
            System.out.println("FilePermissionCollection passed");
    static void tryBasicPC() throws Exception { 
Connect your IDE to all the code out there  Get Codota for Java