Access denied ("java.util.PropertyPermission" "user.name" "read") Java Applet for 1.8.0_25 version

3.4k Views Asked by At

I have this applet:

import java.applet.Applet;

public class UserNapplet extends Applet {
public void init() { }
public String getUser() {
    try {
    return System.getProperty("user.name");
    } catch (Exception e) {
    e.printStackTrace();
    return "error";
    }
}
}

and html tag:

<div id="aple"><applet code="UserNapplet.class" height="0" width="0" id="uname" archive="UserNapplet.jar"/></div>` 

How to make it work?

What I did? a bat file .....

del UserNapplet.jar
del UserNapplet.class
javac UserNapplet.java
jar cvf UserNapplet.jar UserNapplet.class
jar ufm UserNapplet.jar mymanifest.txt
jarsigner -verbose UserNapplet.jar SecGen 

//(SecGen is my "certificate")...

mymanifest.txt says:

Permissions: all-permissions
Application-Name: SecGen
Codebase: http://172.31.31.4/MyAppDir `  (a folder in C.\inetpub\wwwroot)

The running policytools generates

/* AUTOMATICALLY GENERATED ON Wed Dec 10 08:29:52 PYST 2014*/    
/* DO NOT EDIT */    
grant codeBase "file:///C:/inetpub/wwwroot/MyAppDir/UserNapplet.jar" {
permission java.security.AllPermission;
permission java.util.PropertyPermission "*", "read";
};

With all of this.... the applet still throwing

java.security.accesscontrolexception: access denied ("java.util.propertypermission" "user.name" "read")

What more to do?

0

There are 0 best solutions below