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

Reading files in applet

 
Sharada Kumaran
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My applet is supposed to read from a file, and display certain graphics. I use a file reader in the follwoing manner -
FileReader fr = new FileReader("InfoText.txt");
The applet gives the error that it cannot access file InfoText.txt
However, when I convert the same to an application, it runs fine.
What is the problem? I tried giving the complete path using file separators. "c:" + File.separator + ....
didn't work. What could the error be?

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets have security restrictions placed on them... one of these is that they shouldn't be trying to read files from the users hard drive...

If you really have to do this, you will need to look up info on signed applets. They give the applet more lenient security management, but they warn the client about it first.

-Nate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic