This must be something very fundamental, and I appreciate any guidance.
I've written an Applet using "BlueJ" that runs fine in it's AppletViewer, but cannot be run in a browser. My applet reads a text file, which is located in the same directory.
I've researched this to tears and can't get my head around the cause. I've tried putting everything onto a webserver, created and signed the JAR file, etc. From what I've read, the Applet should be able to read a file from the same directory without going through the jarsigner steps.
Here's a snippet of the code
And the corresponding error:
java.security.AccessControlException: access denied (java.io.FilePermission 2009Participants_R2.txt read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
Thanks in advance...
"Proof that there is intelligent life in Oregon. Well, Life anyway.
I've written an Applet using "BlueJ" that runs fine in it's AppletViewer, but cannot be run in a browser. My applet reads a text file, which is located in the same directory.
I've researched this to tears and can't get my head around the cause. I've tried putting everything onto a webserver, created and signed the JAR file, etc. From what I've read, the Applet should be able to read a file from the same directory without going through the jarsigner steps.
Here's a snippet of the code
Code:
private void loadFile()
{
Frame parent = new Frame();
File partFile = new File("Participants_R2.txt");
if (partFile == null)
return;
map = new TreeMap<Integer, Entrant>();
try
{
BufferedReader br = new BufferedReader(new FileReader(partFile));
String strLine = "";
StringTokenizer st = null;
int lineNumber = 0, tokenNumber = 0;
while ((strLine = br.readLine()) != null)
{
lineNumber++;
st = new StringTokenizer(strLine, ",");
tokenNumber = 3;
Entrant = stripQuotes(st.nextToken());
Firm = stripQuotes(st.nextToken());
blank = st.nextToken();
while(st.hasMoreTokens())
{
tokenNumber++;
pick[tokenNumber] = stripQuotes(st.nextToken());
}
}
}
catch(IOException e)
{
JOptionPane.showMessageDialog(parent,
"I/O error in file\n\n " +
partFile.getName() +
"\n\nThis program will close",
"I/O Error",
JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
And the corresponding error:
java.security.AccessControlException: access denied (java.io.FilePermission 2009Participants_R2.txt read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
Thanks in advance...
"Proof that there is intelligent life in Oregon. Well, Life anyway.