Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

read and write files using applet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a applet basically made for a Game. I want to have a text file called hiscores which is accessed by this applet and writes the userid into this with this total no of moves made.
The applet is running fine but am not able to get the applet write into or read the file. It always says file not found.
reply me ASAP
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Due to security restrictions, applets can not direcly access local file system unless they are given permissions by the user.

To enable your applet to acess the file system, you should edit the policy files and give appropriate permissions.You can do this by using policytool command or manually edit policy files.Give FilePermission(read and write) to the text file. You can give permission based on the codebase and/or signed authority.
Other approaches are: store user statistics in local variables or on the server side.
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive same problem. Even just reading the files in a certain directory, what do you mean policy file? is it the attribute of the file (read-only, archive ...) ? Thanks...
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you want to store the data on the client:
I have a signed (but not certified) applet which happily reads and writes to the local disk, if the user agrees to let it by clicking "Yes" to the security warning while it is loading. www.i2Brain.com/appletI2Brain.html.
If you want to store the data on the server, you'll need a small CGI there to do it. Have a look at the URLConnection class and look it up in a search enging with the term "CGI".
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic