File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Signed Applet writing to file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Signed Applet writing to file" Watch "Signed Applet writing to file" New topic
Author

Signed Applet writing to file

Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
I know that the signed applet is working properly as I can do an exec and copy a local file to lpt1. However, when I go to create the file, nothing happens - no security exception, no ioexception. No value in tmp. Probably a dumb mistake, but I'm not too proud to admit it...

String tmp=new String();
// Create temp file for writing print command to file
File temp = new File("c:/temp", "print.tmp");
boolean success = temp.createNewFile();
if (success) {
// File did not exist and was created
tmp="new file created";
} else {
// File already exists
tmp="file already exists";
}

// Write to file
BufferedWriter out = new BufferedWriter(new FileWriter(temp));
out.write("aString");
out.flush();
out.close();
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
Ignore this topic. I had a shadow jar file that my html page was looking at. All is good now.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Signed Applet writing to file
 
Similar Threads
Threads: Multiple Readers and One writer
Creating a Temporary File
Download File
Created File cannot be Deleted
Strange File Behavior