Re: Access denied
Steve W. Jackson ha scritto:
In the program below (downloaded from Sun java site) I get in <init>
trying to read my 4 files >>>
[quoted text clipped - 13 lines]
to it. That's first, even before deciding whether the file(s) in
question have appropriate access permissions.
The files have all of the permission flags ,as I said.
As Steve suggested, the permissions flags on the files
is largely irrelevant to the fact that an..
The applet ...
..applet launched in a browser (as opposed to an applet
launched using AppletViewer, or one launched using the
'main()' shown in the code), gains a restrictive security
environment that does not allow access to *any* File
objects - *unless*:
- the applet code is (jar'd &) digitally signed
- the user agrees to grant extended permissions,
Note these resources/images might be fetchable using
an URL relative to the codebase, but I am prompted
to ask why are you making an applet? Generally
applets would have no need or purpose for files.
Applets are difficult and quirky, their only real
point is to come off the net in a web page, but
anything that can be done in an applet on a web
page can be done in a web start application,
better. Especially if it needs to gain access to
local disk drives.
...below works fine with the same files !
What on earth do you mean by that? You
earlier stated the code is throwing a security
exception - that is an odd definition of 'fine'.
Message posted via http://www.javakb.com