aspose file tools*
The moose likes Applets and the fly likes saving a file on local PC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "saving a file on local PC " Watch "saving a file on local PC " New topic
Author

saving a file on local PC

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
How can I save a string in a text file ?
My way :
.
.
.
BufferedWriter file;
String s = new String("Test");
file = new BufferedWriter(new FileWriter("textfile.txt"));
file.write(s);
.
.
.
does'nt work !
(I wrote this sourcecode without the book, where I read that. It is possible that there are some mistakes.)
I wrote that as an applet, but the file was not created.
HELP PLEASE !!
seeknew
Greenhorn

Joined: Aug 25, 2000
Posts: 11
You cannot create a file on the local machine using an applet. Java security manager does not allow this.
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Thanks for the help. Is there really no way, may be with Java Script, Html or something like this ?
seeknew
Greenhorn

Joined: Aug 25, 2000
Posts: 11
No you cannot create a text file on a local machine using Javascript or HTML. But I think you can create a text file using a signed applet using JDK 1.2. When the user requests a page containing this applet, the browser asks the user whether or not to download the applet and give permission to create a file. If the user agrees, then the applet can create a text file. Otherwise no.
sanjay marjara
Greenhorn

Joined: Sep 22, 2000
Posts: 7
Originally posted by Bonkers:
How can I save a string in a text file ?
My way :
.
.
.
BufferedWriter file;
String s = new String("Test");
file = new BufferedWriter(new FileWriter("textfile.txt"));
file.write(s);
.
.
.
does'nt work !
(I wrote this sourcecode without the book, where I read that. It is possible that there are some mistakes.)
I wrote that as an applet, but the file was not created.
HELP PLEASE !!

Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
How to use a signed applet??
Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Yes, how can I use a signed applet ?
How must I use the security manager to ask the user?
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
I haven't tried it yet myself, but this looks like a good site for the information you want:
http://java.sun.com/security/signExample/index.html
Hope it helps. Let us know.
Stephanie
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Thanks Stephenie
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Do I need to have jdk1.1.How can I run it on jdk1.2.1??
Please reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: saving a file on local PC