I have been looking up on the internet for quite a while how to make a FileWriter object in an applet. I always do exactly as the code says and get a permissions exception. I don't really know what to do about all of this...I am working on a UNIX filesystem, and I have even tried setting the permissions for the directory my applet is in to 777. The following is the code I used:
Ach! What have I done wrong lassie, what have I done wrong.
Hi, Welcome to JavaRanch! Applets are meant to be downloaded across the Internet and run on a client. They're by default run in a "sandbox" in which they're not given access to local resource like files -- think of all the naughty things they could do otherwise! Before an applet can open a file, it has to have a digital signature, and it has to ask permission. This can be thorny business. See here for some information about this. [ February 09, 2004: Message edited by: Ernest Friedman-Hill ]
Hi Last year i wrote an Library applet. I had a whole library system where the admin could manage users, users could login, borrow, return books/cd's etc also change their pass. Every user had a sepparate file where their info was stored such as password, books borrowed, date of borrow and returned, overdues, etc... . Every time a user was created by the admin in the applet, a new file would be created with the user's name and password FROM an applet. I used Windows and i had no problems writing such a code. Is what your trying to do resemble what i did? To create files from applets? if so i can help u out, no prob. D.X
"We all are unique, just like everybody else"
author and iconoclast
D - Welcome to JavaRanch! We don't have too many rules here, but we do have our naming policy which requires that your display name be spelled out -- the last name can't be an initial. Please here over here to update yours, pronto. Thanks -- hope to see you around the Ranch!
Joined: Feb 08, 2004
What I want is for the applet to make a file on the server, not on the client...
Originally posted by Contra Kirby: What I want is for the applet to make a file on the server, not on the client...
Then you'd have to use a remote protocol, such as FTP (more common) or at least HTTP (a request to a servlet) to provide the server with the relevant details (where to put the file, what to name it, and its contents). You can't just use the normal stream I/O remotely (unless you have something like a remote mounted disk).