0

我创建了一个具有以下结构的小程序

    - EXAMPLE
         -WEB-INF
            -web.xml
         -index.jsp
         -AudioApplet.java

当我编译 AudioApplet 文件时,我得到了 5 个 .class 文件。然后我运行以下命令来创建包含所有 .class 文件的 jar 文件。

   jar cvf *.class

创建jar文件后,我将该jar文件放在同一个文件夹中。在我的jsp代码中是

<applet
  code="AudioApplet.class"
  archive="jar name"
  width="450" height="250">

C:\Program Files\Java\jdk1.6.0_21\bin>keytool -genkey -keystore myKeystore -alias myVoice

Enter keystore password:  
Re-enter new password:  
What is your first and last name?  
  [Unknown]:  AAAAA
What is the name of your organizational unit?  
  [Unknown]:  xxxxxx  
What is the name of your organization?  
  [Unknown]:  yyyyy  
What is the name of your City or Locality?  
  [Unknown]:  chennai  
What is the name of your State or Province?  
  [Unknown]:  tn  
What is the two-letter country code for this unit?  
  [Unknown]:  in  
Is CN=Saravanan, OU=xxxxx, O=yyyyy, L=chennai, ST=tn, C=in correct?  
  [no]: yes  


Enter key password for <myVoice>  
        (RETURN if same as keystore password):  
Re-enter new password:

我像这样签署小程序。我得到了错误

java.security.AccessControlException: access denied ("javax.sound.sampled.AudioPermission" "record")  
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 com.sun.media.sound.JSSecurityManager.checkRecordPermission(Unknown Source)  
at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(Unknown Source 
.................

当我单击其中一个将录制语音的按钮时。

这里可能出了什么问题。我是小程序的新手。提前谢谢...

4

1 回答 1

0

一个命令keytool -genkey -keystore myKeystore -alias myVoice只是创建密钥,它不签署 jar。

要签署 jar,请使用jarsigner --keystore myKeystore foo.jar myVoice

于 2013-08-13T05:11:05.983 回答