Bonkers,
The problem is probably that you wrote your code as an applet. Applets have security restrictions imposed on them such that they cannot write files on the local machine. If you try the code as an application, it will work. See example below:
import java.io.*;
public class
Test {
public static void main(String args[])
{
String s = new String("The string to write to file.");
try
{
FileWriter fw = new FileWriter("textfile.txt");
fw.write(s);
fw.close();
}
catch(IOException ioe)
{
System.out.println(ioe.getMessage());
}
}
}
Hope this helps.
Stephanie