AccessControlException
Hi,
I wrote an applet that is supposed to open and read a file from its own code base. I thought applets could read files that are in their code base.
Here's how I attempt to open the file:
File f = new File (getCodeBase().toString()+"newfile.txt");
BufferedReader r = new BufferedReader ( new FileReader (f));
I thought my applet would work but instead I get the following error message:
java.security.AccessControlException: access denied (java.io.FilePermission file:\C:\HASTOPLKJR\newfile.txt 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 java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at GJApplet$GPanel.openFile(GJApplet.java:99)
at GJApplet$GPanel.<init>(GJApplet.java:43)
at GJApplet.init(GJApplet.java:24)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Can anyone help me?
thanks a lot!

