I opened the FileDialog, and I'm able to select the file that i want. However When I try to examine the file (FileReader)i get the following in the console window:
This is a block of my code:
fr = new FileReader(fileString);
br = new BufferedReader(fr);
String line = br.readLine();
while (line!=null){ //not EOFSystem.out.println(line + "\n");line = br.readLine();
}
This is what I get in the Console at line fr = new FileReader
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\acheikhali\Desktop\testing.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.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at iNetVuBootLoader.fileParser(iNetVuBootLoader.java:289)
at iNetVuBootLoader.actionPerformed(iNetVuBootLoader.java:270)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This may have something to do with Signing the applet, in which i'm not sure how it is done exactly. Do you know what the problem might be ?
Yeah, the problem is that applets are by default not allowed to access the file system. So you got a security exception. Actually I'm surprised that you were even able to see a file.
Apparently if you sign the applet, you can do things like access files. However I've never done this myself so I don't know the details. I believe there's an applet signing tool included in the JDK. You may have to additionally assign specific permissions. Google for tutorials if the docs included with the JDK aren't sufficient.