Code example for FilePermission

0
     */ 
    @SuppressWarnings("nls") 
    public void test_checkExecLjava_lang_String() { 
        // enable all but one check 
        mutableSM.addPermission(new AllPermission());
        mutableSM.denyPermission(new FilePermission("<<ALL FILES>>", "execute"));
        try { 
            mutableSM.checkExec("java");
            fail("This should throw a SecurityException.");
        } catch (SecurityException e) {
            // expected 
        } 
    } 
 
    /** 
     * @tests {@link java.lang.SecurityManager#checkExit(int)} 
     */ 
    @SuppressWarnings("nls") 
    public void test_checkExit_int() { 
        // enable all but one check 
Stop searching for code, let great code find you!  Add Codota to your java IDE