Applet中的AccessControlException

时间:2010-08-10 06:20:37

标签: java applet

这个小程序在eclipse查看器中运行良好。我无法从任何浏览器运行它。我该如何解决这个问题?我从我的java applet控制台得到了这个错误:

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)

2 个答案:

答案 0 :(得分:2)

在浏览器中运行的Applet使用安全管理器。浏览器中的applet有很多东西是不允许的。如果您坚持要求您的applet执行这些操作,请将您的applet部署为signed applet

答案 1 :(得分:1)

相应地编辑您的策略文件。请参阅this了解如何操作。