Setting Permissions for an Applet

See Also

By default, applets do not have access to resources on a client's computer, such as threads and disk operations. An applet's permissions are defined in its applet.policy file. If you have an applet policy file, you can specify its location in the IDE. Then, when you run the application, the IDE uses the applet policy file that you specified. If you do not specify an applet policy file, the IDE generates one for you when you run the applet. The applet policy file that the IDE generates for you grants all permissions to the applet. You can use the Source Editor to modify the policy file, so that appropriate security checks are done.

To specify the location of an existing applet policy file:

  1. Right-click the project node and choose Properties.
  2. In the left pane of the Project Properties dialog box, select Run.
  3. In VM Options, specify the location of the applet policy file. For example, use the following setting to specify that the applet policy file is in the project's root folder:

    -Djava.security.policy=applet.policy

  4. Click OK.

To use the IDE to generate an applet policy file:

  1. Run the applet.

    The IDE creates an applet policy file.

  2. In the Files window, expand the project node and double-click the applet.policy file.
  3. In the Source Editor, set permissions according to your needs.
  4. Right-click the project node and choose Properties.
  5. In the Project Properties dialog box, select Run.
  6. In VM Options, note that the IDE has specified the location of the applet policy file. By default, the applet policy file is in the project's root folder:

    -Djava.security.policy=applet.policy

  7. Click OK.
See Also
Creating an Applet
Running an Applet
Accessing an Applet from a JSP Page

Legal Notices