Reputation: 4821
I have an applet embedded in browser. In the applet init()
method I have the below code:
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
public void eventDispatched(AWTEvent event) {
if(event instanceof MouseEvent){
MouseEvent evt = (MouseEvent)event;
if(evt.getID() == MouseEvent.MOUSE_CLICKED){
System.out.println("Mouse Clicked");
}
}
}
}, AWTEvent.MOUSE_EVENT_MASK);
When applet loads I'm getting error:
access denied ("java.awt.AWTPermission" "listenToAllAWTEvents")
Now in my policy file (path below) I appended at the bottom:
grant {
permission java.security.AllPermission;
};
C:/Program Files/Java/jdk1.7.0_10/jre/lib/security/java.policy
But I'm still getting same access denied problem.
Anyone has any idea why I'm still getting that error even though I'm granting all permissions in the java.policy
file?
Upvotes: 1
Views: 1151
Reputation: 168845
Here is a link to trusted code written/deployed by me. It produces the java.home
property for the JVM.
Here it points to:
C:\Program Files (x86)\Java\jre7
Note that no part of that path contains jdk
as I now note in the path above. Ensure the policy file is on the same path as the one identified in the applet.
Upvotes: 2