-2

I am getting a file permmission error when I use my Java applet on my website. The error is:

access denied ("java.io.FilePermision""image.png""read")
mKorbel
  • 109,525
  • 20
  • 134
  • 319
Ajay
  • 437
  • 7
  • 22

2 Answers2

5

An applet operates in a restricted environment (known as a security sandbox) and,unless it is signed, can only load resources from the same location from where it was loaded. The images can be included in the applet jar file. To access these, you could use

Image image = ImageIO.read(MyApplet.class.getResourceAsStream("/images/image.png"));
Reimeus
  • 158,255
  • 15
  • 216
  • 276
4

Applets are by default denied from accessing the client's file I/O. You need to sign your applet or edit the policy files.

You can check How Can An Applet Read Files On The Local File System

StarPinkER
  • 14,081
  • 7
  • 55
  • 81