你是不是那个文件是只读的啊?
D:/1.txt

解决方案 »

  1.   

    SecurityException - if a security manager exists and its checkRead method denies read access to the file or the mode is "rw" and the security manager's checkWrite method denies write access to the file.
      

  2.   

    首先D:/1.txt不能是只读的,另外如果你的程序是写在applet里的,applet是不能访问文件系统的,会抛出安全问题的违例来。
      

  3.   

    public class Sb {
        StringBuffer sb=new StringBuffer("nihao");
        public Sb() {
        try{
        PrintWriter p=new PrintWriter(new FileOutputStream("d:/1.txt"));
        p.println(sb.toString());
        p.close();
        }catch(IOException e){
            e.printStackTrace();
        }
     }
        public static void main(String[] args) {
            new Sb();
        }
    }
      

  4.   

    是啊
    我的是一个APPLET,那我该怎样把一个APPLET处理的内容保存到本地的硬盘下呢!
    请帮个忙啊!