• 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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!