Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Help me to load Image in applet

 
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
 
Rancher
Posts: 43016
76
  • 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.
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic