Applet com problema de Acesso

Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.io.FilePermission audiofile read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.SecurityManager.checkRead(SecurityManager.java:871) at java.io.FileInputStream.<init>(FileInputStream.java:100) at com.sun.media.sound.WaveFileReader.getAudioInputStream(WaveFileReader.java:205) at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1162) at Figura.jButton2ActionPerformed(Figura.java:353) at Figura.access$300(Figura.java:44) at Figura$5.actionPerformed(Figura.java:339) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Estou tentando acessar um arquivo de audio e da esta msg de erro, alguem ja passou por isso ou tem alguma ideia do que pode ser.

Grato

Renato

Se o arquivo é só para leitura, então você pode acessá-lo pela sua URL, em vez de usar FileInputStream, que dá problemas de acesso mesmo.

Na realidade, preciso ler, ver e ouvir, pois pode ser um som ou imagem e poder alter.

Seu applet esta assinado?

abraço

Nao tenho a menor ideia do que seja assinado, ainda nao tinha feito nenhum applet, e o primeiro, enquanto eu so estava fazendo botoes, campos de texto tudo bem ele funcionava bem. Agora que quero colocar um filme ou um som ta dando problema.

procure sobre assinatura de applets
ele precisa ser assinado para te acesso a maquina do cliente.

  • ou - isso
    abraço

Procurei nos post e achei bastante material a respeito, quanto ao keytool blz funcionou agora o jassigner, nao acontece nada.

C:\JMF\MeuApplet>jarsigner -keystore c:\jmf\meuapplet\arquivo -storepass 123456 -signedjar MeuApplet.jar key
Usage: jarsigner [options] jar-file alias
       jarsigner -verify [options] jar-file

[-keystore <url>]           keystore location

[-storepass <password>]     password for keystore integrity

[-storetype <type>]         keystore type

[-keypass <password>]       password for private key (if different)

[-sigfile <file>]           name of .SF/.DSA file

[-signedjar <file>]         name of signed JAR file

[-digestalg <algorithm>]    name of digest algorithm

[-sigalg <algorithm>]       name of signature algorithm

[-verify]                   verify a signed JAR file

[-verbose]                  verbose output when signing/verifying

[-certs]                    display certificates when verbose and verifying

[-tsa <url>]                location of the Timestamping Authority

[-tsacert <alias>]          public key certificate for Timestamping Authority

[-altsigner <class>]        class name of an alternative signing mechanism

[-altsignerpath <pathlist>] location of an alternative signing mechanism

[-internalsf]               include the .SF file inside the signature block

[-sectionsonly]             don't compute hash of entire manifest

[-protected]                keystore has protected authentication path

[-providerName <name>]      provider name

[-providerClass <class>     name of cryptographic service provider's
  [-providerArg <arg>]] ... master class file and constructor argument

Gerando o certificado:

keytool -genkey -alias certificadoteste

Aplicar o certificado criado ao seu .jar que contém o applet:

jarsigner applet.jar certificadoteste

ai ele vai te pedia senha, e vc digita a mesma que vc digitou na hora de criar o certificado =D

Valeu mesmo funciona corretamente.

Muito Obrigado.