Tutorial :AccessControlException in Applet



Question:

This applet runs fine in eclipse viewer. I cannot run it from any browser. How can I resolve this issue? I get this error from my java applet console:

  Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.awt.AWTPermission watchMousePointer)   at java.security.AccessControlContext.checkPermission(Unknown Source)   at java.security.AccessController.checkPermission(Unknown Source)   at java.lang.SecurityManager.checkPermission(Unknown Source)   at java.awt.MouseInfo.getPointerInfo(Unknown Source)   at nopulse.update(nopulse.java:448)   at nopulse.paint(nopulse.java:316)   at sun.awt.RepaintArea.paintComponent(Unknown Source)   at sun.awt.RepaintArea.paint(Unknown Source)   at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)   at java.awt.Component.dispatchEventImpl(Unknown Source)   at java.awt.Container.dispatchEventImpl(Unknown Source)   at java.awt.Component.dispatchEvent(Unknown Source)   at java.awt.EventQueue.dispatchEvent(Unknown Source)   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)   at java.awt.EventDispatchThread.run(Unknown Source)  


Solution:1

Applets running in a browser use a Security Manager. There are many things that applets in a browser are not allowed to do. If you insist that your applets do these things, deploy your applet as a signed applet


Solution:2

Edit your policy files accordingly. See this on how to do it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »