Code example for Permission

Methods: getName

0
        } 
 
        SecurityManager sm = new SecurityManager() {
 
            public void checkPermission(Permission perm) {
                if (perm.getName().equals("checkExec")) {
                    throw new SecurityException();
                } 
            } 
 
            public void checkExec(String cmd) {
                throw new SecurityException();
            } 
        }; 
 
        try { 
            Runtime.getRuntime().exec(new String[]{}, envp);
            fail("IndexOutOfBoundsException should be thrown.");
        } catch(IndexOutOfBoundsException ioob) {
            //expected 
        } catch (IOException e) {