• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet cant read file

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic