Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default, the SecurityManager checkPermission method(s) forward all calls to the java.security.Accesscontroller.checkPermission. Sometimes it is required to perform checks against a different context than the currently executing threads' context. This can be done using the checkPermission(Permission perm, Object context) method which takes an extra argument (like AccessControlContext) as the context of the desired thread.

Wiki MarkupThe default policy file {{java.policy}} grants a few permissions (reading system properties, binding to unprivileged ports and so on) and can be found in the {{~/java.home/lib/security}} directory on *nix based systems and its equivalent on Microsoft Windows systems. There is also a user specific policy file in the user's home directory. The union of both these policy files defines the permissions given to a program.

If the default policy file needs to be bypassed in lieu of a custom policy file, a double equals (==) idiom should be used.

Code Block
bgColor#ccccff

java -Djava.security.manager -Djava.security.policy==policyURL LocalJavaApp

The appletviewer automatically installs a security manager with the standard policy file. To specify additional policy files, use the -J flag.

Code Block
bgColor#ccccff

appletviewer -J-Djava.security.manager -Djava.security.policy==policyURL LocalJavaApp

Wiki Markup
 permissions given to a program. The document \[[Policy 02|AA. Java References#Policy 02]\] discusses writing policy files in depth.

...