1

Hi I have created a Self Signed Applet , but not able to access local files system .What have i to do ?

Kamal
  • 43
  • 1
  • 6

2 Answers2

1

you need to wrap your IO code inside PrivilegedAction.

Generally, you need to sign your applet with your test certificate, the user will see a warning and will have to accept the certificate when it loads the applet.

then you need to wrap your code inside a PriviligedAction. see this for some examples.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87
  • Hi Omry can you please explain me .What are the steps required for the applet to access my Local files . – Kamal Mar 23 '10 at 09:54
  • Oh God . I tried a lot .. but could not know how to use this Privileged Action . Omry do you have any code examples etc . Only if you have post them .else it ok – Kamal Mar 23 '10 at 10:37
1

The below code is use to Add a Bouncy Castle Jar, the same way you can use it for accessing the file. AccessController java api is used.

AccessController.doPrivileged(new PrivilegedAction() {          
  public Object run() {
    try{
      Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());      // Here you can write the code for File Accesss
    }catch (Exception e) {
      return "";
    }
    return "";
  }
}); 
John Willemse
  • 6,608
  • 7
  • 31
  • 45
Kamal
  • 43
  • 1
  • 6