• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applet cant read file

Ranch Hand
Posts: 4716
Scala Java
  • 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: 4716
Scala Java
  • 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.
We're being followed by intergalactic spies! Quick! Take this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic