Bookmark Topic Watch Topic
  • New Topic

Help me to load Image in applet

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Report post to moderator
sir following code throwing a lot of exception . I would like to know why


import java.net.URL;
import java.applet.*;
import java.awt.*;
public class first extends Applet{
Image abc;
public void init(){
abc=Toolkit.getDefaultToolkit().getImage("D:/MyPhoto");
}
public void paint(Graphics g){
g.drawImage(abc,30,30,this);
}
}

java.security.AccessControlException:access denied (java.io.FilePermission D:/MyPhoto read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.lang.SecurityManager.checkPermission(SecurityManager.java.545)
at java.lang.SecurityManager.checkPermission(SecurityManager.java.890)
at sun.awt.SunToolKit.getImageFromHash(SunToolKit.java:266)
at sun.awt.SunToolKit.getImage(SunToolKit.java:266)
at first.init(first.java:7)
at sun.applet.AppletPanel.run(AppletPanel.java:344)
at java.lang.Thread.run(Thread.java.484)

Thanks
Arun
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm closing this thread because it is a duplicate of this one.. Please don't post the same question multiple times.
 
    Bookmark Topic Watch Topic
  • New Topic