我该如何分配applet

时间:2012-07-16 17:43:12

标签: java applet

tutorial之后,我在第7步,我不明白在PolicyTool做什么。我需要在我的应用程序中分配我的applet,因为当我运行我的applet时,我得到一个SecurityException,其中包含以下错误消息:

Could not open file policy C:\Program Files\Java\jdk1.7.0_05\bin\raystore: 
sun.security.provider.PolicyParser$ParsingException line 1: expected [;] found[pípí]

1 个答案:

答案 0 :(得分:2)

  

这是一个文件,其内容显然会导致问题:   C:\ Program Files \ Java \ jdk1.7.0_05 \ bin \ raystore

生成密钥时

keytool -import -alias company -file 
        CompanyCer.cer -keystore 
    raystore -storepass abcdefgh

仔细检查它是否在同一位置实际生成了文件。

然后,

keystore "/home/ray/raystore"; // make sure you reference the path to the key you generated in the previous step

// A sample policy file that lets a program 
// create demo.ini in user's home directory
// Satya N Dodda

grant SignedBy "company" {
  permission java.util.PropertyPermission 
    "user.home", "read";
  permission java.io.FilePermission 
    "${user.home}/demo.ini", "write";
};

修改

生成密钥

keytool -genkey -keystore mykeys -storepass abc123 

签署jar

jarsigner -keystore mykeys -storepass abc123 app.jar johndoe
  

http://docs.oracle.com/javase/tutorial/deployment/jar/signing.html