Karthik
Karthik

Reputation: 63

How to set java.awt.awtpermission in policy file?

My code is like getWaitMessageBox().setAlwaysOnTop(true);.

This throws the

java.security.AccessControlException: access denied (java.awt.AWTPermission setW indowAlwaysOnTop) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.awt.Window.setAlwaysOnTop(Unknown Source)

So I need to set the awtpermission in my policy file for "setAlwaysOnTop".

How can I add this into my policy file?

Upvotes: 0

Views: 1059

Answers (1)

Stephen C
Stephen C

Reputation: 719307

The "Default Policy Implementation and Policy File Syntax" explains the syntax of policy files. The syntax is here.

The "Permissions in Java™ SE 7 Development Kit (JDK)" document lists all of the standard permissions. The permissions for AWT are listed here.

From these we can deduce that the permission should be set as follows:

    permission java.awt.AWTPermission "setWindowsAlwaysOnTop";

The permission target is confirmed by the javadoc.

Upvotes: 1

Related Questions