Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saving a file on local PC

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot create a file on the local machine using an applet. Java security manager does not allow this.
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. Is there really no way, may be with Java Script, Html or something like this ?
 
seeknew
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to use a signed applet??
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, how can I use a signed applet ?
How must I use the security manager to ask the user?
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stephenie
 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I need to have jdk1.1.How can I run it on jdk1.2.1??
Please reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic