创建文件并写入内容
java 写入文件
public void createFile() throws IOException{ ServletContext s1=this.getServletContext(); String temp=s1.getRealPath("/"); File f = new File(temp+"log.txt"); f.createNewFile(); FileWriter fw=new FileWriter(f,true); fw.write("ccccccccccccccccccccc001"); fw.close(); }