Java 7 unsigned applet permissions 1.7.0_45

2019-04-10 08:32发布

问题:

We have an applet which requires certain permissions, which we sign and grant all permissions.
At development time however we use an unsigned applet.
We set all permissions in the user's .java.policy file in their home directory.

This has stopped working in 1.7.0_45 (or possibly _40), as the unsigned applet no longer has the extra permissions.
We are seeing an error like this:
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "OurCustomSystemProperty" "read")

CAUSE
Sun have changed the security behaviour of unsigned applets in 1.7.0_45 or 40.
They have now created and set a new deployment property:

deployment.security.use.user.home.java.policy=false

This means the user's .java.policy file is ignored by default.

RESOLUTION
Please see my answer below.

回答1:

RESOLUTION

Either:

A. Edit your deployment.properties and set the above property to true
The path for this is of the form: C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment\deployment.properties
Add a line like this anywhere in the file:

deployment.security.use.user.home.java.policy=true

or

B. Edit your JRE's central java.policy file and grant all permissions to your applet
The path for this is of the form: C:\Program Files (x86)\Java\jre7\lib\security\java.policy

HTH!