R.E
R.E

Reputation: 107

Is possible Run Java Applet without edit java.policy file?

I have a java applet for load my DLL Library (IAIK Library).

I want to use it from JavaScript. I signed it and load in IIS for run in Web page.

But always occurs security access error. If I add bellow code to java.policy, it work correctly.

grant { permission java.security.AllPermission;};  

I use this structure in my applet

public void method() {
    AccessController.doPrivileged(new PrivilegedAction() {

        public Object run() {
            // It will work if your applet is signed
            callWeb();
            return null;
        }

    });

}

private void callWeb() {

}

Upvotes: 1

Views: 414

Answers (2)

R.E
R.E

Reputation: 107

I follow this operations:

  1. I put my native code in privileged block.
  2. I change value of Permissions in Manifest file in my jar, from sandbox to allpermissions
  3. I sign it and then OK.

Thank you.

Upvotes: 2

Andrew Thompson
Andrew Thompson

Reputation: 168825

Is possible Run Java Applet without edit java.policy file?

It sure is. Digitally sign the applet. Since this needs to be done before deployment in any case, you might as well figure out how to do it now.

Upvotes: 2

Related Questions