• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

saving a file on local PC

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!


 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to use a signed applet??
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, how can I use a signed applet ?
How must I use the security manager to ask the user?
 
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Stephenie
 
Sunita Vontel
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do I need to have jdk1.1.How can I run it on jdk1.2.1??
Please reply.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic