Click to See Complete Forum and Search --> : Java Applet Permissions


jenden
12-16-2003, 02:36 AM
Ok, I'm working on a fairly simple java applet but I've hit a block I can't figure out (still fairly new to applets, so it may be something simple). I've got a picture in the same web directory as the applet and I'm trying to load it up as an icon. I've tried various different approaches and every time I it doesn't start and the java consol gives me a string of error messages (pasted below). any help or suggestions would be greatly appreciated.

java.security.AccessControlException: access denied (java.io.FilePermission http://jenden.endofinternet.net/NA.jpg read)
at java.security.AccessControlContext.checkPermission (Unknown Source)
at java.security.AccessController.checkPermission(Unk nown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at Config.<init>(Config.java:26)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

voidinit
12-16-2003, 03:34 AM
Originally posted by jenden


java.security.AccessControlException: access denied (java.io.FilePermission http://jenden.endofinternet.net/NA.jpg read)


How are you trying to load the image? Are you using java.awt.image, or java.io.file, etc. And what are you passing as a URI. Give me a code snippet.

jenden
12-16-2003, 10:37 AM
I'm trying to load the image from this web address (the one in the error) using the ImageIcon class constructor.

ImageIcon dIcon= new ImageIcon("http://jenden.endofinternet.net/NA.jpg");

I've tried giving it a absolute path like this, I've tried giving it a relative path, I've even tried using the getCodeBase() method to make sure it was looking at the right address. Let me know if there's anything else in my code that might help.