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
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.
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".