Access Control Exception: access denied( "java.io.FilePermission" "[image]" "read")

Andreea picture Andreea · Jul 28, 2015 · Viewed 9.9k times · Source

I'm on my first week using Java. I don't know very much about applets, and I'm trying to learn more using a book. I've already done some applets that contain simple animation, but when I tried drawing an image I've got stock on this:

access denied( "java.io.FilePermission" "[image]" "read").

Anyone who can help me?

    import java.awt.Graphics;
    import java.awt.Image;

    public class Wave extends java.applet.Applet{

        Image waveimg;

        public void init(){

            waveimg=getImage(getCodeBase(),"wave.jpg");

        }

        public void paint(Graphics g){

            g.drawImage(waveimg, 10,10,this);

        }
  }

Answer

Kami picture Kami · Jul 28, 2015

This is because Applets need permissions to read/write from/to files. Maybe this page can help you: How Can An Applet Read Files On The Local File System