Java 2 Network Security



Figure 4. GetPrintJob Applet Running
However, upon clicking on the getPrintJob button, no print operation on the
toolkit's platform will be initiated and you will see a security exception being
displayed on the Command Prompt window from which you launched the
Applet Viewer:

There was an exception, java.security.AccessControlException: access denied
(java.lang.RuntimePermission queuePrintJob )
The same exception will be displayed every time the button is clicked.
The reason for this exception is that the applet has not been granted any
permissions before being downloaded, so it has to run in a restricted
environment. When its button is pressed and the applet attempts to initiate a
print operation on the toolkit's platform, a security exception is thrown
because the applet is attempting to run out of its restricted environment.