Lucas_Santos
Lucas_Santos

Reputation: 4740

How can I Assign a applet

Following this tutorial, i'm on the step 7, and I don't understand what to do in PolicyTool. I need that to assign my applet in my application, because when I run my applet I got a SecurityException with the following error message:

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í]

Upvotes: 1

Views: 358

Answers (1)

Sully
Sully

Reputation: 14943

This is a file, and its contents are apparently causing a problem: C:\Program Files\Java\jdk1.7.0_05\bin\raystore

When you generate the key

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

Double check that it actually generated a file in the same location.

Then,

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";
};

Edit:

Generate key

keytool -genkey -keystore mykeys -storepass abc123 

Sign jar

jarsigner -keystore mykeys -storepass abc123 app.jar johndoe

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

Upvotes: 2

Related Questions