Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java.security.AccessControlException: access denied (java.io.FilePermission background.jpg read)

1 view
Skip to first unread message

clowtown

unread,
Dec 7, 2004, 5:04:51 PM12/7/04
to
I am extremely new to java and this is the first I've worked with
applets, so any help will be appreciated but I stress that I am new but
very capable. I have looked on many message boards but I don't
understand most of what they are talking of. I have written a simple
Breakout game and would like to put it on a web page. However, when I
load the web page I get an error that the applet failed to load and
here is the message:

java.security.AccessControlException: access denied
(java.io.FilePermission background.jpg read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown 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 GraphicsPanel.loadImageFromFile(GraphicsPanel.java:34)
at GraphicsPanel.<init>(GraphicsPanel.java:23)
at Breakout.<init>(Breakout.java:111)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(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)

clowtown

unread,
Dec 7, 2004, 5:06:19 PM12/7/04
to

Andrew Thompson

unread,
Dec 8, 2004, 12:59:51 AM12/8/04
to
On 7 Dec 2004 14:06:19 -0800, clowtown wrote:

> I am extremely new to java and this is the first I've worked with
> applets,

That is a bad combination.
<http://www.physci.org/codes/javafaq.jsp#appfirst>

>..so any help will be appreciated but I stress that I am new but
> very capable.

I would not determine a person to be 'very capable' if
they were not able to solve a straightforward error from
a stacktrace.

>..I have looked on many message boards but I don't


> understand most of what they are talking of. I have written a simple
> Breakout game and would like to put it on a web page.

URL?

>..However, when I


> load the web page I get an error that the applet failed to load and
> here is the message:
>
> java.security.AccessControlException: access denied
> (java.io.FilePermission background.jpg read)

...
> at GraphicsPanel.loadImageFromFile(GraphicsPanel.java:34)


At line number 34 of the loadImagFromFile method of GraphicsPanel,
you are attemtping to use a File object[1]. You are not allowed to
do that in an unsigned applet[2]. Use an URL instead[3].

[1] <http://www.physci.org/codes/javafaq.jsp#exact>
[2] <http://www.physci.org/codes/javafaq.jsp#security>
[3] <http://www.physci.org/codes/javafaq.jsp#path>

BTW - please refrain from x-posting[4] between c.l.j.programmer and
c.l.j.help. Follow-ups set to c.l.j.help.

[4] <http://www.physci.org/codes/javafaq.jsp#xpost>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane

0 new messages