File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes ach! do applets and filestreams not mix? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "ach! do applets and filestreams not mix?" Watch "ach! do applets and filestreams not mix?" New topic
Author

ach! do applets and filestreams not mix?

Contra Kirby
Greenhorn

Joined: Feb 08, 2004
Posts: 7
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.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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 ]

[Jess in Action][AskingGoodQuestions]
Tony Xavier
Greenhorn

Joined: Feb 07, 2004
Posts: 7
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"
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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!
Contra Kirby
Greenhorn

Joined: Feb 08, 2004
Posts: 7
What I want is for the applet to make a file on the server, not on the client...
Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202
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).
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Conrad- Welcome back. Looks like maybe you misplaced your old account - here it is. "Contra" isn't quite what we had in mind for "real name".


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ach! do applets and filestreams not mix?