Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet cant read file

 
Randall Twede
Ranch Hand
Posts: 4489
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am writing an Applet and get an exception trying to read a file in the same folder.
I have read files from Applets before???
public void loadQuiz(String selection) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(selection + ".txt"));
Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.io.FilePermission Easy.txt read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkRead(SecurityManager.java:890)
at java.io.FileInputStream.<init>(FileInputStream.java:61)
at java.io.FileReader.<init>(FileReader.java:38)
at Quiz.loadQuiz(Quiz.java:59)
at Quiz.actionPerformed(Quiz.java:50)
at java.awt.Button.processActionEvent(Button.java:329)
at java.awt.Button.processEvent(Button.java:302)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
 
Randall Twede
Ranch Hand
Posts: 4489
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should have searched before I asked. It seems I have to open the stream using a URL instead of a String.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic