Malone
09-11-2004, 10:07 PM
java.security.AccessControlException: access denied (java.io.FilePermission words.txt read)
There is the error in my Java Control Panel Console thingy when I try to load my applet in a browser. I've tried IE and FireFox. Are applets unable to read files located in the same directory as the applet? Or is there something simple I have to change?
// build the dictionary tree
String dictionaryFN = "words.txt";
try
{
BufferedReader fin = new BufferedReader(new FileReader(dictionaryFN));
String word = fin.readLine();
while (word != null)
{
dictionary.insert(word);
word = fin.readLine();
}
fin.close();
}
catch (FileNotFoundException e)
{
System.err.println("FileNotFoundException: " + e.getMessage());
return false;
}
catch (IOException e)
{
System.err.println("IOException: " + e.getMessage());
return false;
}
There is the code in question. Maybe I'm doing something wrong? Any help is appreciated.
There is the error in my Java Control Panel Console thingy when I try to load my applet in a browser. I've tried IE and FireFox. Are applets unable to read files located in the same directory as the applet? Or is there something simple I have to change?
// build the dictionary tree
String dictionaryFN = "words.txt";
try
{
BufferedReader fin = new BufferedReader(new FileReader(dictionaryFN));
String word = fin.readLine();
while (word != null)
{
dictionary.insert(word);
word = fin.readLine();
}
fin.close();
}
catch (FileNotFoundException e)
{
System.err.println("FileNotFoundException: " + e.getMessage());
return false;
}
catch (IOException e)
{
System.err.println("IOException: " + e.getMessage());
return false;
}
There is the code in question. Maybe I'm doing something wrong? Any help is appreciated.