Max
Max

Reputation: 1334

java.security.AccessControlException: access denied ("java.awt.AWTPermission" "accessClipboard")

When I load my applet I get the Exception

java.security.AccessControlException: access denied ("java.awt.AWTPermission" "accessClipboard").

Have googled for couple of hours and have seen the answers like,

  1. Adding the permissions in java policy - This is strictly internal process. But need to work in all machines.

  2. Adding applet tag instead of object - Didn't work for me.

  3. Keytool to be used to sign the applets - Have added the custom certificate to sign the applets. Still getting the exception.

Please help out guys.

Upvotes: 0

Views: 3178

Answers (2)

Max
Max

Reputation: 1334

@yakovsh : The blog is really helpful. Just a small change worked for me...

java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction(){
            public Object run() {
                // execute the privileged command
                executeCommand(cmd);
                // we must return an object, so we'll return an empty string
                return new Object();
            }
        }
    );

The only change is with the return statement from return "" to return new Object()

Upvotes: 0

Y. S.
Y. S.

Reputation: 346

You can try using Javascript within Java to get to the privileged methods:

http://blog.pengoworks.com/index.cfm/2008/2/19/Accessing-privileged-methods-in-a-Java-Applet-via-JavaScript

Upvotes: 1

Related Questions