Jump to content

Permissões Applet


magnos

Recommended Posts

Boa tarde,

deparei-me com um problema na execução do meu código no browser, IE10, Chrome e Firefox. Quando executo o código a partir do NetBeans ele executa tudo sem problemas, mas quando é executado a partir do browser deparo-me com um erro na consola de JAVA. Já sei que o problema é das permissões para ler ficheiros a partir do computador pela Applet, só que não consigo dar as devidas permissões, e já tentei todas as soluções que me apareceram na minha pesquisa.

Por favor caso alguém saiba como contornar o problema e se possível mostrar aqui como agradeço.

estou a correr a JRE version 1.7.0_25-b17 Java HotSpot™ Client VM

o erro que me aparece na consola JAVA é o seguinte

Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setSecurityManager")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at java.lang.System.setSecurityManager0(Unknown Source)
at java.lang.System.setSecurityManager(Unknown Source)
at Horta.plantar.actionPerformed(plantar.java:27)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(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.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)

Desde já agradeço a ajuda

Edited by magnos
Link to comment
Share on other sites

As soluções tentadas foram as seguintes:

grant {
permission java.security.AllPermission;
}; 

no java.policy localizado C:\Program Files\Java\jre7\lib\security\java.policy.

Também tentei usar o aplicativo policy do java e acrescentar uma permissão para leitura assim como colocar todas as permissões.

Assim como tentei uma linha código

System.setSecurityManager(null);

aonde encontrei esta solução dizia somente para acrescentar esta linha de código à applet.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.