This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Applets and the fly likes Applets and filereading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applets and filereading" Watch "Applets and filereading" New topic
Author

Applets and filereading

Mikael Bjorkman
Greenhorn

Joined: Nov 28, 2000
Posts: 2
I know that an applet is not allowed to read or write files on the local system, but is it possible to write and read to/from a textfile on the same server it was downloaded from?
I would need this to transfer parameters to and from the applet.
I would really appreciate any help on this.
Thanks
Mike
Tanveer Rameez
Ranch Hand

Joined: Dec 11, 2000
Posts: 158
hi
I think you can read and write to files in the same server if it is in the same folder or sub-directory as that of the applet.Use the ordinary FileInputStram or you can use URL to hold the address of the file and then access it thru DataOutputStream.
hope this helps
bye
Tanveer


Author of JPhotoBrush Pro (www.jphotobrushpro.com)
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
Yeah, you should be able to do it like this:

or you can use a DataInputStream or whatever, as long as you open it with 'url.openStream()'.
 
wood burning stoves
 
subject: Applets and filereading